C # Compiler: / nostdlib

How is it possible not to include stdlib (mscorlib.dll) in my C # application when compiling? As far as I know, all classes inherit the System.Object class, which is defined in the mscorlib.dll file. Moreover, types like int are just aliases, for example. for System.Int32, which are also defined in mscorlib. Is this parameter used?

+6
c # mscorlib
source share
4 answers

Yes, it is used by someone who compiles a program that does not start with the desktop version of the CLR. Like Silverlight, it targets the .NETCore or Micro Framework. They have their own mscorlib.dll, of course, using System.Object.

Here is the command line of the Silverlight project compiler:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE;SILVERLIGHT /reference:"c:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\mscorlib.dll" etc... 
+9
source share

According to the docs

http://msdn.microsoft.com/en-us/library/fa13yay7(VS.80).aspx

You use it if you are trying to replace system classes.

+2
source share

You can also use it if you want to build for deployment in the old version. Visual Studio (in any case, 15) uses this option when creating a project configured for an earlier version of the framework version. Instead of using the standard mscore, it uses one of the Reference Assemblies / Microsoft / Framework / vx.y

+1
source share

From MSDN - "Use this parameter if you want to define or create your own namespace and System objects.". Fair enough - I will not do it any time soon, tho '. :)

0
source share

All Articles