/target (Visual Basic)
Specifies the format of compiler output.
/target:{exe | library | module | winexe}
The following table summarizes the effect of the /target option.
|
Option |
Behavior |
|---|---|
|
/target:exe |
Causes the compiler to create an executable console application. This is the default option when no /target option is specified. The executable file is created with an .exe extension. Unless otherwise specified with the /out option, the output file name takes the name of the input file that contains the Sub Main procedure. Only one Sub Main procedure is required in the source-code files that are compiled into an .exe file. Use the /main compiler option to specify which class contains the Sub Main procedure. |
|
/target:library |
Causes the compiler to create a dynamic-link library (DLL). The dynamic-link library file is created with a .dll extension. Unless otherwise specified with the /out option, the output file name takes the name of the first input file. When building a DLL, a Sub Main procedure is not required. |
|
/target:module |
Causes the compiler to generate a module that can be added to an assembly. The output file is created with an extension of .netmodule. The .NET common language runtime cannot load a file that does not have an assembly. However, you can incorporate such a file into the assembly manifest of an assembly by using /reference. When code in one module references internal types in another module, both modules must be incorporated into an assembly manifest by using /reference. The /addmodule option imports metadata from a module. |
|
/target:winexe |
Causes the compiler to create an executable Windows-based application. The executable file is created with an .exe extension. A Windows-based application is one that provides a user interface from either the .NET Framework class library or with the Win32 APIs. Unless otherwise specified with the /out option, the output file name takes the name of the input file that contains the Sub Main procedure. Only one Sub Main procedure is required in the source-code files that are compiled into an .exe file. In cases where your code has more than one class that has a Sub Main procedure, use the /main compiler option to specify which class contains the Sub Main procedure |
Unless you specify /target:module, /target causes a .NET Framework assembly manifest to be added to an output file.
Each instance of Vbc.exe produces, at most, one output file. If you specify a compiler option such as /out or /target more than one time, the last one the compiler processes is put into effect. Information about all files in a compilation is added to the manifest. All output files except those created with /target:module contain assembly metadata in the manifest. Use Ildasm.exe (MSIL Disassembler) to view the metadata in an output file.
The short form of /target is /t.
To set /target in the Visual Studio IDE
-
Have a project selected in Solution Explorer. On the Project menu, click Properties. For more information, see Introduction to the Project Designer.
-
Click the Application tab.
-
Modify the value in the Application Type box.