[Solved] I want to create a dll of .cs file by code [closed]


You can use compiler as services – CodeDomCompiler feature to create dll/exe on the fly.

How to programmatically compile code using C# compiler

Compiling wiht CodeDom – Article on codeproject

Alternative approach is to compile files CSC.exe command line tool to create the library. For this you need to launch new process with appropriate arguments.

 Process.Start( Path.Combine(GetCscFolderLocation() ,"csc"),  "/target:library File1.cs File2.cs /reference: <reference 1> <reference2> ..."

 string GetCscFolderLocation()
 {
 // Getting CSC location
 }

Getting CSC.exe folder location is tricky. Follow this to get an idea.

Following example starts text file in default editor.

Process.Start(@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.e‌​xe", @"/target:library /out:C:\test\test.dll c:\test\File.cs");

15

solved I want to create a dll of .cs file by code [closed]