Use the csc command to compile the. cs file into. dll

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: WINDOWSMicrosoft. switch NETFrameworkv1.1.4322 to the directory where vs.net is installed-> execute the csc command csc/target: library File. cs-> Generate a corresponding name under this directory. dll file (premise: Put. put the cs file in C: WINDOWSMicrosoft. NETFrameworkv1.1.4322 directory)
Csc commands are used in many ways. refer to the following,

------------------------------------
Translate 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 is the most widely used command. In fact, it can be simply written as csc/t: library File. another way of writing cs 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. It is useful to install two cs files into A. dll file.

Related Article

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.