Csc.exe compile C # code

Source: Internet
Author: User
This document describes how to use csc.exe to directly compile C # and generate EXE and DLL. CSC is a built-in compiler for the framework. Source files can be compiled into executable files or dynamic link libraries. Each Framework version has a CSC version. If vs is installed, vs also has the corresponding CSC. Program . Do not search in drive C.

The main parameters of CSC are as follows:

/out: specify the output file name (default value:
file containing the main class or the base name of the first file)
/target: EXE generation console executable file (default) (Abbreviation:/T: exe)
/Target: winexe generate Windows Executable File (Abbreviation:/T: winexe)
/Target: Library generation Library (Abbreviation:/T: Library)
/Target: module generation module that can be added to other assembly (Abbreviation:/T: module)

/Reference: <alias >=< File> use the given alias to reference metadata from the specified Assembly file (Abbreviation:
/R)
/Reference: <file list> reference metadata from the specified Assembly file (Abbreviation:/R)

The type of the file generated for the target.
Example:CSC/T: Library/Out: "C: \ helloworld"/R: "system. configuration. dll" "C: \ source \*. Cs"

if multiple references exist, add ";"/R: "C: \. DLL ";" C: \ D. DLL ";" system. configuration. DLL "
the last" C: \ source \*. CS is to compile all Cs files in the source directory.
the compiled EXE or dll has no version number or other information. If you want to add assembly. CS, just copy the automatically generated vs file.

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.