简体   繁体   English

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

[英]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 开发环境中设置此编译器选项

  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.修改不引用 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.

相关问题 无法将 mscorlib.dll 添加到 Visual Studio 项目 - Cannot add mscorlib.dll to Visual Studio project 如何从 VS2015 中引用不同的 mscorlib.dll? - How to reference a different mscorlib.dll from within VS2015? 抛出异常:mscorlib.dll,Visual Studio C# 中的“System.IO.FileNotFoundException” - Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll, Visual studio C# Visual Studio,调试在 mscorlib.dll 中随机抛出 SEHException 未处理的异常,没有 stackTrace - Visual studio, debugging randomly throws SEHException unhandled exception in mscorlib.dll with no stackTrace IOFileNotFoundException mscorlib.dll - IOFileNotFoundException mscorlib.dll Visual Studio 2015问题。 mscorlib.dll中发生“ System.Data.SqlClient.SqlException”,但未在用户代码中处理 - Visual Studio 2015 issue. 'System.Data.SqlClient.SqlException' occurred in mscorlib.dll but was not handled in user code 发生PingException mscorlib.dll - PingException occurred mscorlib.dll 如何解决mscorlib.dll无法从环境变量中提取“ MySqlPassword”? - how to solve mscorlib.dll Could not extract 'MySqlPassword' from Environment variables..? 如何加载多个mscorlib.dll并分别调用它们的内部函数? - How to load multiple mscorlib.dll and call their inner functions separately? 我如何找到程序正在使用的mscorlib.dll? - How do I find which mscorlib.dll a program is using?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM