Beruflich Dokumente
Kultur Dokumente
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter C
Command-Line Syntax
APPENDIX
C
In addition to the compilers for C# (csc.exe), C++ (cl.exe), and VB .NET (vbc.exe)
the Microsoft .NET Framework SDK adds a number of tools designed to make it easier for
you to create, deploy, and manage applications and components that target the .NET
Framework. This appendix will introduce these tools and will also detail the com-
mand-line usages of csc.exe.
Command Utilities
In order to be able to run these command-line utilities, you must configure the environ-
ment properly. The Visual Studio .NET installation includes a command file
(VCVARS32.BAT) that configures the command environment properly. The command
file is installed in the \bin directory of your installation (the default is c:\Program
Files\Microsoft Visual Studio.NET\vc7\bin). The command file is config-
ured during the installation of Visual Studio to correspond to your computer’s set-up.
Do not replace a missing or damaged VCVARS32.bat file with a VCVARS32.bat from
another machine. Rerun setup to replace the missing file.
To run VCVARS32.BAT you can execute it from the path or you can use the shortcut.
Select Start | Programs | Microsoft Visual Studio .NET | Visual Studio .NET Tools | Visual
Studio .NET Command Prompt.
P:\010Comp\All-in-1\443-6\appc.vp
Monday, August 26, 2002 11:57:13 AM
Color profile: Generic CMYK printer profile
All-In-One
Composite Default screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter C
Tool Description
Microsoft CLR Debugger (DbgCLR.exe) Provides debugging services with a graphical interface
to help application developers find and fix bugs in
programs that target the runtime.
Runtime Debugger (Cordbg.exe) Provides command-line debugging services using
the Common Language Runtime Debug API. It is
used to find and fix bugs in programs that target
the runtime.
Table C-1 The .NET Framework SDK Debugging Tools
Tool Description
Assembly Cache Viewer (Shfusion.dll) Lets you to view and manipulate the contents of
the Global Assembly Cache using Windows
Explorer.
Assembly Linker (Al.exe) Allows you to use either resource files or
Microsoft Intermediate Language (MSIL) files to
generate a file with an assembly manifest.
Assembly Registration tool (Regasm.exe) Registers .NET Framework classes to the
Registry, which allows COM clients to create
.NET Framework classes transparently.
Assembly Binding Log Viewer Displays log-file information for failed assembly
(Fuslogvw.exe) binding. This information can help you diagnose
the reasons the .NET Framework has problems
locating an assembly at run time.
Global Assembly Cache tool (Gacutil.exe) This tool allows you to view and manipulate the
contents of the Global Assembly Cache and
download cache. You can use Gacutil.exe
in build scripts, makefile files, and batch files.
Installer tool (Installutil.exe) Allows you to install and uninstall server
resources by executing the installer components
of a specified assembly.
Isolated Storage tool (Storeadm.exe) Displays and manages all existing stores for the
currently logged-on user.
Native Image Generator (Ngen.exe) Lets you create a native image from a managed
assembly and install the image in the native
image cache on the local computer.
Table C-2 The .NET Framework SDK Configuration and Deployment Tools
P:\010Comp\All-in-1\443-6\appc.vp
Monday, August 26, 2002 11:57:13 AM
Color profile: Generic CMYK printer profile
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter C
Security Tools
Tool Description
Certificate Creation Tool (Makecert.exe) Creates X.509 certificates for testing
PART VII
purposes only.
Certificate Manager tool (Certmgr.exe) Manages certificates, certificate trust lists
(CTLs), and certificate revocation lists (CRLs).
Certificate Verification tool (Chktrust.exe) Verifies the validity of a file signed with an
X.509 certificate.
Table C-3 The .NET Framework SDK Security Tools
P:\010Comp\All-in-1\443-6\appc.vp
Monday, August 26, 2002 11:57:14 AM
Color profile: Generic CMYK printer profile
All-In-One
Composite Default screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter C
General Tools
Tool Description
Common Language Runtime Minidump tool Creates a file containing a core dump of
(Mscordmp.exe) information that can be useful when analyzing
system issues in the runtime.
License Compiler (Lc.exe) Allows you to create a .licenses file that
can be embedded in a Common Language
Runtime executable. It reads text files that
contain licensing information.
Management Strongly Typed Class Generator Allows you to quickly generate an early-bound
(Mgmtclassgen.exe) class for a specified Windows Management
Instrumentation (WMI) class.
MSIL Assembler (Ilasm.exe) Generates a PE file from Microsoft Intermediate
Language (MSIL).
MSIL Disassembler (Ildasm.exe) Produces a MSIL source file from a Portable
Executable (PE) file.
Table C-4 The .NET Framework SDK General Tools
P:\010Comp\All-in-1\443-6\appc.vp
Monday, August 26, 2002 11:57:14 AM
Color profile: Generic CMYK printer profile
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter C
C# Compiler (csc.exe)
In order to compile and run a C# program, you will need to have the .NET Framework
installed on your computer. Microsoft has made the .NET Framework available as a free
upgrade, and you can either download it from http://msdn.microsoft.com (approxi-
mately 130MB) or order a CD with the .NET Framework.
After installation, the C# compiler is available from the command prompt to create
Portable Executable (PE) files from your source files (see the previous “Command Util-
ities” section for information on how to set up the environment for use with com-
mand-line tools).
Using the C# Compiler (csc.exe) is rather complicated because it has a large family
of command line options that control the behavior of the compiler. The next section
will give you an overview of most of the command-line switches that are available.
C:\>csc /help
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
Visual C# .NET Compiler Options
- OUTPUT FILES -
/out:<file> Output file name (default: base name of file with main
class or first file)
/target:exe Build a console executable (default) (Short form:
/t:exe)
…
P:\010Comp\All-in-1\443-6\appc.vp
Monday, August 26, 2002 11:57:14 AM
Color profile: Generic CMYK printer profile
All-In-One
Composite Default screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter C
P:\010Comp\All-in-1\443-6\appc.vp
Monday, August 26, 2002 11:57:14 AM
Color profile: Generic CMYK printer profile
Composite DefaultAll-In-One
screen / MCAD/MCSD Visual C# .NET Certification All-in-One Exam Guide / Rempel & Lind / 222443-6 / Chapter C
csc File.cs
• Compiles all of the C# files in the current directory, with optimizations on and
defines the DEBUG symbol. The output is File2.exe:
• Compiles all of the C# files in the current directory, producing a debug version
of File2.dll. No logo and no warnings are displayed:
PART VII
P:\010Comp\All-in-1\443-6\appc.vp
Monday, August 26, 2002 11:57:14 AM