Mega Code Archive

 
Categories / ASP.Net Tutorial / Development
 

Building Component Libraries by Using the C# Command-Line Compiler

The C# compiler is located at the following path: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe The Visual Basic command-line compiler is located at the following path: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vbc.exe You can use the csc.exe tool to compile any C# source file like this: csc /t:library SomeFile.cs The /t (target) option causes the compiler to create a component library and not a Console or Windows application.  When you execute this command, a new file named SomeFile.dll is created, which is the compiled assembly. To compiling a single file, you can compile all the source code files in a folder (and every subfolder) like this: csc /t:library /recurse:*.cs /out:MyLibrary.dll The /recurse option causes the compiler to compile the contents of all the subfolders.  The /out option provides a name for the resulting assembly.