An error occurred while trying to restore packages. Please try again.
有没有解决这个问题的经验?我怎样才能找出导致错误的具体原因?
An error occurred while trying to restore packages. Please try again.
有没有解决这个问题的经验?我怎样才能找出导致错误的具体原因?
这样应该可以解决问题。
我曾经遇到了与 Microsoft.Bcl.Build.1.0.14
NuGet 包类似的问题。我解决这个问题的方法是:
如果您不想要这个软件包,只需双击打开 packages.config 文件,找到引用您不想要的软件包的行,然后删除该行即可。
如果您确实需要这个软件包,可以使用NuGet重新下载它,这将可能解决问题。
我通过下载最新版本的NuGet解决了同样的问题(安装非常简单,下载速度很快):http://docs.nuget.org/docs/start-here/installing-nuget
一定是一个初学者的答案,但我会留下它,因为我没有在其他地方找到这个答案。确保 nuget.org 没有从您的软件包源中取消选中。
工具. 选项. Nuget软件包管理器. 软件包源。确保 “nuget.org” 已经被选中。
在我的情况下,我们开发了自己的NuGet包。当我打开一个包含之前版本的NuGet包的解决方案时,这些包已被删除或移除或由于某种原因无法访问。这使得无法构建包含特定NuGet包的项目。我尝试安装/重新安装/升级NuGet包,但是没有成功,出现以下错误(请参见下面的图像),我还尝试了所有可能的答案,并确保包存在,但没有成功。
尝试恢复包时发生错误:找不到版本xxx..etc。
Close your solution and find the path of the solution
Open all your projects .csproj files with notepad editor, that contain the packages that have the issue and remove all references that is shown in the error message, looks like this and save:
<Reference Include="Xxx, Version=30.0.0.16927, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xxx.35.1.122605\lib\net461\Xxx.dll</HintPath>
</Reference>
In each folder where your .csproj is located, you find packages.config
file, open it with notepad editor and remove all packages that is shown in the error message, looks like this and save:
<package id="Xxx" version="35.1.122605" targetFramework="net461" />
Start your solution, the error now should disappear, but you can not build because we have removed references and packages. So now you should be able to install your missing packages in fresh. When done build and all should work. Enjoy :)