【发布时间】:2017-04-16 05:11:09
【问题描述】:
我使用 Visual Studio 2015 的 GitHub 扩展将我的项目克隆到新计算机上。我尝试恢复软件包,但收到一条错误消息:
NuGet Package restore failed for project PROJECT: Unable to find version 2.0.0 of package 'Microsoft.Net.Compilers'
我已经研究了一些关于类似问题的其他问题,但这些解决方案都没有对我有用。
我尝试删除包文件夹,再次打开 Visual Studios,然后重新构建。这并没有解决它。
我尝试在包管理器控制台中手动安装 Microsoft.Net.Compilers。
PM> Install-Package Microsoft.Net.Compilers
我尝试从 csproj 文件中删除这段代码(这似乎对某些人有用):
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
我尝试重新安装所有软件包
Update-Package –reinstall
到目前为止,我还没有解决这个问题的运气。任何帮助表示赞赏。
编辑:
I tried the response below and received this error:
Install-Package : Some NuGet packages are missing from the solution. The packages need to be restored in order to build the dependency graph. Restore the packages before performing any operations.
At line:1 char:16
+ Install-Package <<<< -Id Microsoft.Net.Compilers -Version 1.3.2 -Source nuget.org
+ CategoryInfo : InvalidOperation: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetMissingPackages,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
它还提示我恢复软件包。当我点击恢复时,我得到了和往常一样的错误。
【问题讨论】:
标签: asp.net-mvc visual-studio-2015 nuget-package-restore