How to compile Visual C # code files with CSC.exe

Source: Internet
Author: User
Tags switches

Visual C # is a new generation of software development languages introduced by Microsoft, and Visual C # is an important part of Microsoft's. Net framework framework, and it is Microsoft's strong recommendation to programmers for a newer program development platform. Compared with the previous development language, he has more powerful features, higher stability and higher security. Because of this, Visual C # is being welcomed by more and more programming enthusiasts.

The compiler for Visual C # is significantly different from the compilers of previous programming languages. The biggest difference is that the previous program compiler is to compile the program code to build the machine language that can be used directly for the computer. Although the Visual C # compiler can also compile the written program code into an EXE or a DLL file, this file is just an Il file (intermediate language), which cannot be used directly by the computer. It is only when this IL file is invoked that a JIT (just-in-time) compiler is used to generate this IL file into machine code that is available to the computer.

Visual C # 's compilation process can be roughly divided into two parts, the first part, from the program code to the Il file, the process is done through human intervention, that is, through CSC.exe, the second part, from IL file to machine language, this project is automatically implemented by the machine. This article will specifically explain the first section, how to use CSC.exe to properly compile the Visual C # files.

CSC.exe has many parameters and switch options when compiling Visual C # program code into IL files. The correct understanding and application of these parameters and switches can sometimes solve seemingly intractable problems. Here is a table to outline the specific functions of these parameters and switches. These parameters and switch options are sorted alphabetically. Which with "*", is a number of commonly used parameters or switches.

Options Use
@ * Specifies the response file.
/?,/help Display the compiler's options on the console's computer screen
/addmodule Specify one or more modules as part of the Assembly
/baseaddress Specify the base address of the loaded DLL
/bugreport Create a file that contains information that is easier to report errors
/checked If the integer evaluates the bounds of the overflow data type, an exception event is generated at run time
/codepage Specify the code page for all source code files used in the compilation
/debug * Send debug information
/define Defining preprocessor symbols for preprocessing
/doc * Annotate the processed document as an XML file
/fullpaths Specify the path to compile the output file anyway
/incremental Incrementally compiling files for the source code
/linkresource Link. NET resources to the collection
/main Specify the location of the Main method
/nologo Prohibit use of compiler flag information
/nooutput Compiling files without exporting files
/nostdlib Do not export standard libraries (that is, mscorlib.dll)
/nowarn Compile but the compiler does not display a warning feature
/optimize Turn optimization on or off
/out * Specify Output file
/recurse Searching subdirectories of compiled source files
/reference * Import metadata from a file that contains a collection
/target * Specify the format of the output file
/unsafe Compiling code that uses a non-secure keyword
/warn Set Warning Level
/warnaserror Elevation warning is an error
/win32icon Insert an. ico file to the output file
/win32res Insert a WIN32 resource Guide output file
Specific Description:

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.