尝试在新解决方案中启用NuGet软件包还原时出错 [英] Error when trying to enable NuGet Package Restore in new Solution

查看:1088
本文介绍了尝试在新解决方案中启用NuGet软件包还原时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在刚创建的新解决方案中启用程序包还原时出现错误. VS2012中的错误是:

I am getting an error when trying to enable package restore in a new solution I just created. The error in VS2012 is:

NuGet程序包管理器

NuGet Package Manager

配置解决方案以还原NuGet时发生错误 在构建中的软件包

An error occurred while configuring the solution to restore NuGet packages on build

无法从路径'NuGet.Build.2.7.0.npkg'中读取软件包.

Unable to read package from path 'NuGet.Build.2.7.0.npkg'.

我尝试在VS2010中打开解决方案来解决该问题,并且在尝试启用程序包还原时也遇到了错误,但是消息有所不同:

I tried opening the solution in VS2010 to work around the problem and I am also getting an error when trying to enable package restore, but the message is different:

NuGet程序包管理器

NuGet Package Manager

配置解决方案以还原NuGet时发生错误 在构建中的软件包

An error occurred while configuring the solution to restore NuGet packages on build

存档文件的大小不能为0.

Archive file cannot be size 0.

我尝试创建一个新的解决方案,但是得到了相同的结果.

I tried creating a new solution, but got the same result.

然后我尝试在VS2012更新3上进行修复并重新启动.仍然有问题.

I then tried doing a repair on VS2012 update 3 and rebooting. Still getting the problem.

我还扫描了文件夹,项目和解决方案文件中是否有NuGet或.nupkg的任何内容,但是那里什么也没有.

I also scanned the folder, project, and solution file for anything NuGet or .nupkg, but there is nothing there.

那么我如何才能再次使用此功能?我上次使用它的时间大约是一周前,而且我不记得从那以后我做了什么特别的更改.我卸载了大约一个星期前安装的VS Power Tools软件包,但这也不能解决问题.

So how can I get this feature working again? The last time I used it was about a week ago, and I don't remember specifically what I changed since then. I uninstalled the VS Power Tools package that I installed about a week ago, but that didn't fix the problem either.

更新

我在此处遵循了删除"说明,并使用了一个项目已经具有作为模板来手动启用程序包还原.但是,我仍在寻找更好的解决方案,因为这是我经常使用的功能.

I followed the "removal" instructions here and used a project I already have as a template to enable package restore manually. However, I am still looking for a better solution because this is a feature I use frequently.

我也尝试从Visual Studio卸载并重新安装NuGet,但仍然遇到相同的问题.如果内存可以正确使用,则有一个最近的NuGet更新(是否有VS扩展安装日志,以便我检查?).

I also tried uninstalling and reinstalling NuGet from visual studio, but I still get the same issue. If memory serves correctly, there was a recent NuGet update (is there a log for VS extension installation so I can check?).

推荐答案

我怀疑由于下载失败,NuGet.Build.2.7.0.npkg文件为零字节. NuGet.Build.2.7.0.npkg是Visual Studio下载的NuGet软件包,以便为您的解决方案启用软件包还原.

I suspect that the NuGet.Build.2.7.0.npkg file is zero bytes due to a failed download. NuGet.Build.2.7.0.npkg is the NuGet package that Visual Studio downloads in order to enable package restore for your solution.

看看您的缓存,看看该文件是否为零字节.如果是这样,则删除文件或清除缓存,然后尝试再次启用软件包还原.缓存位于您的个人资料下的类似目录中

Take a look in your cache and see if this file is zero bytes. If so then delete the file or clearing the cache and try enabling package restore again. The cache is under your profile in a directory similar to:

C:\Users\YourUsername\AppData\Local\NuGet\Cache

您还可以通过打开程序包管理器设置",选择常规"并单击浏览"按钮,从Visual Studio中浏览到缓存.

You can also browse to the cache from inside Visual Studio by opening the Package Manager Settings, selecting General and clicking the Browse button.

这篇关于尝试在新解决方案中启用NuGet软件包还原时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆