Use the CSC command to compile the. CS file into a. dll file.

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.