C# FAQ: What is the use of the CSharp compilers target command line option
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:FAQs |
| edit |
[edit]
What is the use of the C# compiler's /target: command line option?
Using the C# compiler's /target: command line switch, all options other than module create .NET assemblies. Depending on the option, the compiler adds metadata for the operating system to use when loading the portable executable (PE) file and for the runtime system to use in executing the contained assembly or module.
/target Option
| Description |
exe
| Creates an assembly with an entry point, but sets the Subsystem field of the PE header to 3—image runs in the Windows character subsystem (See the _IMAGE_OPTIONAL_HEADER structure in winnt.h). ILDASM the PE, to see this as assembled as .subsystem 0x0003. The operating system launches this application this as a console application.
|
library
| Creates an assembly without an entry point by setting the value of the EntryPointToken of the PE's CLR header to 0. ILDASM reveals that the assembly does not contain an .entrypoint clause. Therefore, the runtime system cannot start an application because no entry point is defined.
|
module
| Creates a module. In this case, the PE metadata does not include a manifest. Module/s + manifest makes an assembly—the smallest unit of deployment. Without the metadata of the manifest, the runtime can take no special actions with a module.
|
winexe
| Sets the Subsystem field value to 2—image runs in the Windows GUI subsystem. The operating system will launch this application as a GUI application.
|