我使用Visual Studio 2015的GitHub扩展将项目克隆到新电脑上。我尝试还原包但出现错误,显示如下:
NuGet Package restore failed for project PROJECT: Unable to find version 2.0.0 of package 'Microsoft.Net.Compilers'
我查看了一些关于类似问题的其他问题,但那些解决方案都还没有对我起作用。
我尝试删除packages文件夹,再次打开Visual Studios并重新构建,但这并没有解决问题。
我尝试在包管理器控制台中手动安装Microsoft.Net.Compilers。
PM> Install-Package Microsoft.Net.Compilers
我尝试从csproj文件中删除这段代码(这似乎对某些人有效):
我尝试从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
这也促使我恢复软件包。当我点击恢复时,我收到了和平常一样的错误提示。