
718
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Appendix HCommand-Line Compiler
H
The Visual Basic Command-
Line Compiler
Although the Visual Studio Integrated Development Environment (IDE) is an effi-
cient tool for developing your VB applications, you can actually do all of your
development in Notepad (a.k.a. “Visual Notepad”) and compile the source code
from the Windows command prompt. This appendix details the operation of the
Visual Basic compiler, vbc.exe.
Compiler Basics
The compiler uses command-line switches to control its operation. A command-
line switch is designated by a slash or hyphen, followed by a keyword. If the
keyword takes an argument, it is separated from the keyword by a colon (
:). For
example:
vbc sample1.vb /target:library
indicates that the compiler should generate a library (a DLL file) as the output
target file type. In this case, target is the switch keyword and library is the argu-
ment. If multiple arguments are required, they are usually separated from one
another by commas (unless otherwise noted). For example:
vbc sample1.vb /r:system.design.dll,system.messaging.dll
references the metadata in the system.design.dll and system.messaging.dll
assemblies.
The minimal syntax required to compile a file named sample1.vb is:
vbc sample1.vb
This generates a console-mode application named sample1.exe. You can specify ...