我试图使用nopCommerce(这是写在。net核心),但当我想运行项目时,我面临52个错误告诉我运行一个nuget包恢复

Assets文件~\obj\project.assets。Json没有找到。运行NuGet包还原生成此文件。Nop.Web.MVC.Testsote

当我使用右键单击解决方案并选择恢复Nuget包时,我得到这样的消息:

所有的包都已经安装,没有什么要恢复的。

但是这52个错误仍然存在,在工具-> NuGet包管理器->管理解决方案的NuGet包中,解决方案上没有安装任何东西,我最近更新了我的VS2017到15.5.4


当前回答

另外,如果你碰巧使用Dropbox,检查文件名是否冲突,在你的回购中搜索并删除所有冲突的文件。

如果您移动了文件,可能会发生这种情况。

其他回答

For me it turned out to be a nuget source credentials problem. I had recently changed my password for accessing a nexus server and visual studio was still using the old password when trying to access a nuget on that server through the windows credential manager. To fix it, I had to delete the entry for those outdated credentials in the credential manager and after, when I did a nuget restore, it prompted me for a password letting me enter the new password, which got saved in the credential manager again. You can access the credential manager from the cmd line using CmdKey.exe.

对我来说,我把NuGet.exe从3.4升级到4.9,因为3.4不理解如何恢复。net Core的包。

有关详细信息,请参见teamcity的dotnet恢复与nuget恢复

我的问题是构建配置平台不匹配。一旦我把“任何CPU”改为“x64”,我就可以发布了。

在我的例子中,它是。net项目,在DevOps windows-2019代理上进行构建。

解决方案:windows-2022可以构建。net6。

我没有在任何地方发现微软建议的删除“packages”文件夹的方法。

来源:解决包恢复错误

You may encounter build errors due to missing files, with a message saying to use NuGet restore to download them. However, running a restore might say, "All packages are already installed and there is nothing to restore." In this case, delete the packages folder (when using packages.config) or the obj/project.assets.json file (when using PackageReference) and run restore again. If the error still persists, use nuget locals all -clear or dotnet nuget locals all --clear from the command line to clear the global-packages and cache folders as described on Managing the global packages and cache folders.