简体   繁体   English

NuGet错误还原软件包

[英]NuGet error restoring packages

Suddenly today I click Rebuild on my sln and get... 今天突然我在我的sln上单击“重建”并得到...

Error (~10 similar errors): 错误(〜10个类似错误):

Severity Code Description Project File Line Suppression State Error NuGet Package restore failed for project Core: Unable to find version '4.0.11' of package 'System.Diagnostics.Debug'.. 0 严重性代码说明项目文件行抑制状态错误NuGet项目Core的软件包还原失败:无法找到软件包“ System.Diagnostics.Debug”的版本“ 4.0.11”。0

System.Diagnostics.Debug 4.0.11 exists. System.Diagnostics.Debug 4.0.11存在。

Nuget version: 3.3.0.212 Nuget版本: 3.3.0.212

Other stuff: 其他的东西:

  • At PM console: Install-Package System.Diagnostics.Debug -Version 4.0.11 在PM控制台上:Install-Package System.Diagnostics.Debug -Version 4.0.11

Error: 错误:

Install-Package : Some NuGet packages are missing from the solution. Install-Package:解决方案中缺少某些NuGet软件包。 The packages need to be restored in order to build the dependency graph. 需要还原软件包以构建依赖关系图。 Restore the packages before performing any operations. 在执行任何操作之前,请还原软件包。

  • <RestorePackages> is not listed in the .sln. <RestorePackages>未在.sln中列出 So I don't think this thing is configured the old way . 所以我不认为这件事是用旧方法配置的。

This happened shortly after running windows update. 这是在运行Windows Update之后不久发生的。 I updated NuGet to 3.4 (from 3.3) and the issue resolved itself. 我将NuGet从3.3更新到3.4(此问题已解决)。

in Visual Studio > Tools > Extensions and Updates > Visual Studio Gallery > Nuget Package Manager > Update 在Visual Studio>工具>扩展和更新> Visual Studio库> Nuget软件包管理器>更新中

You need to check you have checked the “Allow NuGet to download missing packages” and “Automatically check for missing packages during build in Visual Studio” options under the VS Tools menu -> Options -> NuGet Packages Manager -> General tab. 您需要检查VS工具菜单->选项-> NuGet软件包管理器->常规选项卡下的“允许NuGet下载缺少的软件包”和“在Visual Studio中构建期间自动检查缺少的软件包”选项。 在此处输入图片说明

If the options are checked but the problem still exist, you need to uninstall all the installed NuGet and then reinstall them again. 如果已选中选项,但问题仍然存在,则需要卸载所有已安装的NuGet,然后再次重新安装它们。

And if uninstall and reinstall could not resolve this issue, you can manually remove the dependency with following steps which refer to this thread : 而且,如果卸载并重新安装不能解决此问题,则可以使用引用此线程的以下步骤来手动删除依赖项:

1.Close Visual Studio (not a hard requirement, but helpful). 1.关闭Visual Studio(这不是一个强制要求,但很有帮助)。 2.In text editor, remove dependency from packages.config. 2.在文本编辑器中,从packages.config中删除依赖项。 3.Remove package from packages/ directory. 3.从packages /目录中删除软件包。 4.In text editor, remove all references to package from .csproj file. 4.在文本编辑器中,从.csproj文件中删除对程序包的所有引用。 5.Start Visual Studio. 5.启动Visual Studio。 6.Reinstall package through NuGet. 6.通过NuGet重新安装软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用NuGet恢复预发布包 - Restoring prerelease packages with NuGet NuGet 恢复包但缺少 DLL - NuGet restoring packages but missing DLLs VIsual Studio 2022 卡在恢复 Nuget 包上 - VIsual Studio 2022 stuck on Restoring Nuget packages 还原 NuGet 包时出错:根级别的数据无效。 第 1 行,位置 1 - Error occured while restoring NuGet packages: Data at the root level is invalid. Line 1, position 1 为什么Nuget在通过命令行恢复包时会随机崩溃? - Why is Nuget randomly crashing when restoring packages via command line? TeamCity不从特定包源恢复NuGet包 - TeamCity not restoring NuGet packages from particular package source 使用dotnet cli使用nuget.org的http版本还原项目的nuget软件包 - Restoring nuget packages of project with the http version of nuget.org using the dotnet cli 将.NET项目从一种解决方案复制到另一种解决方案时,Nuget软件包无法正确还原 - Nuget packages not restoring correctly when Copying and including .NET projects from one solution to another 在VS2015中还原Nuget包命令,仅还原XML,而不还原DLL - Restore Nuget Packages command in VS2015, restoring only XMLs not the DLLs NuGet 安装包时添加引用错误 - NuGet add reference error while installing packages
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM