How to disable mscorlib.dll from within visual stu

2019-06-20 01:26发布

I am trying to use a custom standard library in visual studio 2013 and can't seem to figure it out. I have no problems compiling on the command line using /nostdlib although I would like to be able to take advantage of intellisense in the IDE. I have removed all references except for my custom corelib and I am getting conflicting code errors due to having two variations of mscorlib.

The VS documentation says:

To set this compiler option in the Visual Studio development environment

  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.

Although this does not seem to be the case, as this option does not exist. Does anyone know how I can disable mscorlib.dll in vs2013?

1条回答
smile是对你的礼貌
2楼-- · 2019-06-20 02:26

This is an old question, but, indeed - while the UI option has disappeared (or moved) and the documentation remains misleading to this day, you can still replicate the effect by adding <NoStdLib>True</NoStdLib> into your .csproj near the other options found in advanced settings:

<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    ...
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <NoStdLib>True</NoStdLib>
    <TargetFrameworkProfile />
  </PropertyGroup>
...
</Project>
查看更多
登录 后发表回答