Section H.3. Using a Response File


H.3. Using a Response File

The Visual Basic compiler allows you to specify command-line options and settings from a text file of settings called a response file. The syntax for using a response file is:

     vbc @<file> 

where <file> is the full or relative path of the response file. The response file contains source filenames and compiler switches; it is interpreted as if the filenames and compiler switches were entered directly on the command line.

The syntax of a response file is simple. Multiple filenames or switches can be included on a single line, or you can put each filename and switch on a line of its own. However, a single filename or switch cannot span multiple lines. The # symbol indicates a comment that continues until the end of the line.

Consider the following response file named mylib.rsp:

     # Build the library     /target:library     /out:mylibrary     /debug+     /debug:full     libfunc1.vb     libproc1.vb     libstrings.vb 

The compiler acts on this file by entering the following at the command prompt:

     vbc @mylib.rsp 

Even when using a response file, you can continue to use switches and filenames on the command line, and multiple response files can be used. The compiler processes all command-line arguments in the order in which they appear. This means that settings in a response file can be overridden by specifying command-line options after the response file name, or that command-line settings can be overridden by following them with a response filename. For example, the command line:

     vbc libnumeric.vb @mylib.rsp /debug- 

compiles a file named libnumeric.vb, in addition to the three files already named in mylib.rsp. It also reverses a setting from mylib.rsp by preventing debugging information from being included in the output file.

New in 2005. Beginning with the 2005 release of Visual Basic, the compiler automatically includes a response file named vbc.rsp each time it runs. This file is located in the same directory as the vbc.exe compiler itself. It includes all of the default files and switches that should be included in every compile, such as references to each of the core assemblies shipped with the .NET Framework. Modify this file if you wish to add files or switches to every compile event. You can also tell the compiler to exclude the vbc.rsp file by adding the /noconfig switch to the vbc.exe command.




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net