c# - 如何从 visual studio 2013 中禁用 mscorlib.dll?

标签 c# visual-studio msbuild

我正在尝试在 visual studio 2013 中使用自定义标准库,但似乎无法弄明白。我在命令行上使用/nostdlib 进行编译没有问题,尽管我希望能够在 IDE 中利用智能感知。我删除了除我的自定义 corelib 之外的所有引用,并且由于有两个 mscorlib 变体,我遇到了代码冲突错误。

VS 文档说:

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.

虽然这似乎并非如此,因为这个选项不存在。有谁知道如何在 vs2013 中禁用 mscorlib.dll?

最佳答案

这是一个老问题,但是,确实 - 虽然 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>

关于c# - 如何从 visual studio 2013 中禁用 mscorlib.dll?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26622951/

相关文章:

c# - System.Threading.Timer 一段时间后没有触发

c# - 无法在 Visual Studio 2012 Ultimate SP1 x64 中创建或打开网站

c# - MSBuild,运行自定义工具以生成 linq to sql 模型类的自定义任务?

dll - 为什么 MSTest 不复制引用的项目库?

c# - 使用 BuildEngine 传递 MsBuild 命令行参数

c# - 用 C# 编写 USB 驱动可移植应用程序

c# - 需要帮助以C#实现多线程

c# - 将对象从 C# 传递到 C++ 得到 "cannot use this indirection"?

visual-studio-2010 - Azure 项目未加载

image - 从 Winforms 表单/按钮/图像属性中提取本地资源图像