In many cases, we need to compile the. CS file into a. dll file separately,
The procedure is as follows:
Open the command window-> Enter cmd to the console-> Cd C: \ WINDOWS \ Microsoft. net \ framework \ VX. X to the directory where vs.net is installed (if environment variables are set, do not go to this directory)-> execute the CSC command CSC/Target: library file. CS-> Generate a corresponding directory under the CSC command. DLL file (premise: Put. put the CS file in the directory when you enter the CSC command)
CSC commands are used in many ways. refer to the following,
Compile file. CS to generate file.exe:
CSC file. CS
Compile file. CS to generate file. dll:
CSC/Target: library file. CS
Compile file. CS and create my.exe:
CSC/out: my.exe file. CS
Compile all C # files in the current directory by optimizing and defining the debug symbol. Output is file2.exe:
CSC/define: Debug/optimize/out: file2.exe *. CS
Compile all the C # files in the current directory to generate the debug version of file2.dll. No logo or warning is displayed:
CSC/Target: Library/out: file2.dll/warn: 0/nologo/debug *. CS
Compile all the C # files in the current directory as something. XYZ (a DLL ):
CSC/Target: Library/out: Something. XYZ *. CS
Compile file. CS to generate file. dll: CSC/Target: library file. cs. This is the most widely used command,
In fact, it can be simply written as CSC/T: library file. CS,
Another statement is:
CSC/out: mycodebehind. dll/T: Library mycodebehind. cs. You can specify the output file name by yourself.
CSC/out: mycodebehind. dll/T: Library mycodebehind. CS mycodebehind2.cs. This function is to install two Cs files into A. dll file.
----------
Vs create a project and compile the. CS class library file into. dll.