Generate .dll/.exe using Visual Studio Command Prompt.

Post date: Jun 1, 2011 2:16:02 PM

open Start>>VisualStudio2005/2008 >> Visual Studio tools>>Visual Studio Command Prompt.

Now in command Prompt Locate the Directory where you have saved the .cs file just created. Using CD command.

Here I have given myfile name "test.cs".

Now for compiling our dll using csc.exe we need to pass arguments you csc.exe like what type of file we want to generate, What will be name of output dll file and source file from which we are building our dll File.

csc /target:library /out:MyMaths.dll test.cs

Press Enter and you will get your desired DLL file generated!!

You just have created DLL fFile with Command Line C# Compiler. Now use that dll file in any .net project !!

Now you will raise question how do I compile multiple source file (.cs) files?

Well simple just execute commad like below one pass 2 names of source files in command while compiling it.

csc /target:library /out:MyMaths.dll test.cs test2.cs