Released on: 12/22/2004 | updated on: 12/22/2004
Andrew W. Troelsen, Microsoft MVP
Intertech Training
Abstract: This article analyzes the process of using the C # command line compiler csc.exe to generate an application. In addition, we will introduce many compiler options that are unique to C #2.0, such as extended/reference flag and strong name support. After reading this article, you can easily generate a single-file assembly and multi-file assembly in an environment without a wizard.
Applicable:
Microsoft Visual C #2.0
Note This article assumes that you are familiar with the C # programming language and. NET Framework Structure. It is helpful to try the command line tool.
Download the CSCSample. msi file.
Content on this page
Scsc.exe brings fun
C # compiler option Overview
Configure Environment Variables
Basic command line knowledge
Used to specify input and control output options
Compile the. NET code library
Use C # response File
Reference an external assembly using/reference
C #2.0 alias reference
Use/addmodule to generate multi-file assembly
Create a Windows form application
Use resources through csc.exe
Use/define to define Preprocessor symbols
Debug-centric options of csc.exe
Miscellaneous
Summary
Scsc.exe brings fun
Almost no one will deny the functionality provided by the integrated development environment (IDE) (for example, Visual Studio 2005 and Visual C # Express 2005) that makes programming quite simple. However, in fact, IDE itself generally does not provide access to all aspects of the basic compiler. For example, Visual Studio 2005 does not support multi-file assembly generation.
In addition, understanding the code compilation process in the command line may be useful to users with the following features:
& #8226; prefer the simplest method for generating. NET Framework applications.
& #8226; the secret to how IDE processes source code files.
& #8226; you want to use. NET to generate a utility, such as nant or msbuild.
& #8226; there is no integrated development environment, for example, Visual Studio (but actually has a free. NET Framework SDK ).