[英]How to disable mscorlib.dll from within visual studio 2013?
I am trying to use a custom standard library in visual studio 2013 and can't seem to figure it out.我正在尝试在 Visual Studio 2013 中使用自定义标准库,但似乎无法弄清楚。 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.
我在命令行上使用 /nostdlib 编译没有问题,尽管我希望能够在 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.
我已经删除了除自定义 corelib 之外的所有引用,并且由于有两个 mscorlib 变体,我遇到了相互冲突的代码错误。
The VS documentation says: VS 文档说:
To set this compiler option in the Visual Studio development environment
在 Visual Studio 开发环境中设置此编译器选项
Open the Properties page for the project.
打开项目的“属性”页面。
Click the Build properties page.
单击构建属性页面。
Click the Advanced button.
单击高级按钮。
Modify the Do not reference mscorlib.dll property.
修改不引用 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?
有谁知道如何在 vs2013 中禁用 mscorlib.dll?
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:这是一个老问题,但是,确实 - 虽然 UI 选项已经消失(或移动)并且文档直到今天仍然具有误导性,您仍然可以通过将
<NoStdLib>True</NoStdLib>
到您的 .csproj 附近来复制效果高级设置中的其他选项:
<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>
To workaround the same problem in Visual Studio 2017 , adding the following Property Group declarations inside the .csproj file (you can unload project from Visual Studio and Right Click and choose Edit) did the trick to suppress the compiler errors:要解决Visual Studio 2017 中的相同问题,在.csproj文件中添加以下属性组声明(您可以从 Visual Studio 卸载项目并右键单击并选择编辑)可以抑制编译器错误:
<PropertyGroup>
<NoStdLib>true</NoStdLib>
<DisableHandlePackageFileConflicts>true</DisableHandlePackageFileConflicts>
</PropertyGroup>
...
<ItemGroup>
<Reference Include="mscorlib">
<HintPath>..\path to custom mscorlib.dll</HintPath>
</Reference>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.