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.