-nostdlib (C# Compiler Options)

-nostdlib prevents the import of mscorlib.dll, which defines the entire System namespace.


-nostdlib[+ | -]


Use this option if you want to define or create your own System namespace and objects.

If you do not specify -nostdlib, mscorlib.dll is imported into your program (same as specifying -nostdlib-). Specifying -nostdlib is the same as specifying -nostdlib+.

To set this compiler option in Visual Studio


The following instructions apply to Visual Studio 2015 (and earlier versions) only. The Do not reference mscorlib.dll build property doesn't exist in newer versions of Visual Studio.

  1. Open the Properties page for the project.

  2. Click the Build properties page.

  3. Click the Advanced button.

  4. Modify the Do not reference mscorlib.dll property.

To set this compiler option programmatically

For information on how to set this compiler option programmatically, see NoStdLib.

See also