微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – 在Microsoft.Net.Compilers上添加依赖项后无法加载Visual Studio 2015项目

我的项目依赖于NuGet包Microsoft.Net.Compilers:

<package id="Microsoft.Net.Compilers" version="1.3.2" 
         targetFramework="net461" developmentDependency="true" />

但是,如果我在清除package文件夹后加载Visual Studio,我的项目将不会加载以下错误

The imported project “C:\MyService\packages\Microsoft.Net.Compilers.1.3.2\tools\Microsoft.CSharp.Core.targets” was not found. Confirm that the path in the declaration is correct,and that the file exists on disk.
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets

所以它不会加载项目,因为它缺少一个使用Nuget在构建时恢复的文件,只有在我可以加载项目时它才有效.

解决方法

您可以使用Nuget命令行工具恢复您的包.如果你的系统还没有它,你可以在这里找到它: https://www.nuget.org/

在命令行上发出以下命令:

nuget restore

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐