Working with vbcexe Response Files

As you might guess, if you were to build a complex VB 2008 application at the command prompt, your life would be full of pain as you type in the flags that specify numerous referenced assemblies and *.vb code files. To help lessen your typing burden, the VB 2008 compiler honors the use of response files.

VB 2008 response files contain all the instructions to be used during the compilation of your current build. By convention, these files end in an *.rsp (response) extension. Assume that you have created a response file named TestApp.rsp that contains the following arguments (as you can see, comments are denoted with the # character):

# This is the response file

# for the TestApp.exe app

# External assembly references.


# Output and files to compile (using wildcard syntax).

Now, assuming this file is saved in the same directory as the VB 2008 source code files to be compiled, you are able to build your entire application as follows (note the use of the @ symbol):

vbc @TestApp.rsp

If the need should arise, you are also able to specify multiple *.rsp files as input (e.g., vbc @FirstFile.rsp @SecondFile.rsp @ThirdFile.rsp). If you take this approach, do be aware that the compiler processes the command options as they are encountered! Therefore, command-line arguments in a later *.rsp file can override options in a previous response file.

Also note that flags listed explicitly on the command line before a response file will be overridden by the specified *.rsp file. Thus, if you were to enter vbc /out:MyCoolApp.exe @TestApp.rsp the name of the assembly would still be TestApp.exe (rather than MyCoolApp.exe), given the /out:TestApp.exe flag listed in the TestApp.rsp response file. However, if you list flags after a response file, the flag will override settings in the response file. Thus, in the following command set, your assembly is indeed named MyCoolApp.exe.

vbc @TestApp.rsp /out:MyCoolApp.exe

Note The /reference flag is cumulative. Regardless of where you specify external assemblies (before, after, or within a response file), the end result is a summation of each reference assembly.

Was this article helpful?

0 0

Post a comment