【问题标题】:Unable to load Visual Studio 2015 project after adding dependency on Microsoft.Net.Compilers添加对 Microsoft.Net.Compilers 的依赖后,无法加载 Visual Studio 2015 项目
【发布时间】:2017-01-21 19:51:45
【问题描述】:

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

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

但是,如果我在清除包文件夹后加载 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 在构建时恢复的文件,该文件仅在我可以加载项目时才有效。

【问题讨论】:

  • 使用 NuGet 命令行可执行文件调用nuget restore

标签: c# .net asp.net-mvc visual-studio c#-6.0


【解决方案1】:

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

在命令行上发出这个:

nuget restore

【讨论】:

    猜你喜欢
    • 2021-11-28
    • 1970-01-01
    • 1970-01-01
    • 2020-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-01
    相关资源
    最近更新 更多