简体   繁体   English

NuGet:无法添加对“ mscorlib”的引用

[英]NuGet: Failed to add reference to 'mscorlib'

I'm trying to add a .NET 4 libary to a .NET 4.5.1 solution with NuGet. 我正在尝试使用NuGet将.NET 4库添加到.NET 4.5.1解决方案中。 This should generate the following entry in packages.config and reference the dll. 这应该在packages.config中生成以下条目并引用dll。

<package id="MyCompany.MyApi" version="2.0.1-alpha0680" targetFramework="net451" />

However, the error that I'm getting is: 但是,我得到的错误是:

Error: Failed to add reference to 'mscorlib'. 错误:无法添加对“ mscorlib”的引用。

What does work is the following: 起作用的是以下内容:

  • Add the NuGet package in packages.config 在packages.config中添加NuGet包
  • Reference the dll in the packages folder manually 手动引用packages文件夹中的dll

But obviously this is not my preferred solution. 但这显然不是我的首选解决方案。

Edit: This is not a duplicate of the referenced question. 编辑:这不是所引用问题的重复项。 This issue also occurs when I create a blank console application. 当我创建一个空白的控制台应用程序时,也会发生此问题。 So there isn't even a packages folder yet to clear. 因此,甚至没有要清除的packages文件夹。

After installing update 5 of Visual Studio 2013 the issue was solved. 安装Visual Studio 2013更新5后,此问题已解决。 If someone knows why it would be nice to enrich this answer. 如果有人知道为什么增加这个答案会很好。 Or create a new answer and I'll accept it. 或创建一个新的答案,我会接受的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM