如何从Visual Studio 2013中禁用mscorlib.dll?

问题描述:

我正在尝试在Visual Studio 2013中使用自定义标准库,但似乎无法弄清楚.尽管我希望能够利用IDE中的intellisense,但在使用/nostdlib的命令行上进行编译时我没有任何问题.我删除了除自定义corelib之外的所有引用,由于存在mscorlib的两个变体,我遇到了冲突的代码错误.

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.

VS文档说:

要在Visual Studio开发环境中设置此编译器选项

  1. 打开项目的属性页面.

点击构建属性页面.

点击高级按钮.

修改请勿引用mscorlib.dll 属性.

尽管似乎不是这种情况,因为此选项不存在.有人知道我如何在vs2013中禁用mscorlib.dll吗?

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?

这是一个老问题,但是,确实-尽管UI选项消失(或移动)并且文档至今仍在误导,但您仍然可以复制通过将<NoStdLib>True</NoStdLib>添加到.csproj中靠近高级设置中其他选项的效果:

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>