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

Nic*_*las 3 .net c# asp.net-mvc visual-studio c#-6.0

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

<package id="Microsoft.Net.Compilers" version="1.3.2" 
         targetFramework="net461" developmentDependency="true" />
Run Code Online (Sandbox Code Playgroud)

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

找不到导入的项目"C:\ MyService\packages\Microsoft.Net.Compilers.1.3.2\tools\Microsoft.CSharp.Core.targets".确认声明中的路径是否正确,以及该文件是否存在于磁盘上.
C:\ Program Files(x86)\ MSBuild\14.0\bin\Microsoft.CSharp.CurrentVersion.targets

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

jes*_*ing 7

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

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

nuget restore
Run Code Online (Sandbox Code Playgroud)