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

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

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

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

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


当前回答

我遇到过非常奇怪的经历!

我之前用GIT bash和GIT cmd-Line进行了克隆,遇到了上述问题。

后来,我用turtle - git进行了克隆,一切正常。

也许这是一个疯狂的答案,但尝试一次可能会节省你的时间!

其他回答

我没有任何NuGet在我的CLI/ c++。VS2022建造良好。然而,MSBuild不工作,给我错误NETSDK1004:资产文件…obj \ project.assets。Json没有找到。运行NuGet包还原生成此文件。

我的问题的解决方案是从vcxproj文件中删除以下内容。

<EnableManagedPackageReferenceSupport>true</EnableManagedPackageReferenceSupport>

我想把真改成假可能有用。我删除了行和MSBuild现在工作。

当我在VS2017中创建一个lambda in dot net core时,我得到了错误。对我来说有用的是卸载项目并重新加载它。

我没有在任何地方发现微软建议的删除“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.

回答这个问题有点晚了,但似乎这将增加价值。看看这个错误——它似乎发生在CI/CD管道中。

运行“dotnet build”就足够了。

dotnet构建

Dotnet构建默认运行“还原”。

前面提到过,但我只是想再次强调在路径中没有任何空间的重要性!这就是我想要的。我警告过你了。