大果子你说谁呢 2023-11-09 17:27 采纳率: 65%
浏览 9
已结题

vs2019 添加服务引用时发生错误


Checking project for required NuGet packges...
Installing NuGet packages to project...
Installing package 'NSwag.ApiDescription.Client' with version '13.0.5'.
ErrorNuGet.PackageManagement.PackageReferenceRollbackException: Package restore failed. Rolling back package changes for 'xxx.Server'.
   at NuGet.PackageManagement.NuGetPackageManager.<ExecuteBuildIntegratedProjectActionsAsync>d__80.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.PackageManagement.NuGetPackageManager.<ExecuteNuGetProjectActionsAsync>d__77.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.NuGetPackageManager.<InstallPackageAsync>d__48.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.PackageManagement.NuGetPackageManager.<InstallPackageAsync>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.VisualStudio.VsPackageInstaller.<InstallInternalCoreAsync>d__30.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.VisualStudio.VsPackageInstaller.<InstallInternalAsync>d__29.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at NuGet.VisualStudio.VsPackageInstaller.<InstallInternalAsync>d__29.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at NuGet.VisualStudio.VsPackageInstaller.RunJTFWithCorrectContext(Project project, Func`1 asyncTask)
   at NuGet.VisualStudio.VsPackageInstaller.InstallPackage(String source, Project project, String packageId, String version, Boolean ignoreDependencies)
   at Microsoft.WebTools.Shared.VS.NuGet.NuGetPackageManager.<InstallAsync>d__28.MoveNext()

  • 写回答

3条回答 默认 最新

  • 普通网友 2023-11-09 18:00
    关注

    这个错误信息看起来是在安装NuGet包时出现了问题。以下是一些可能的解决方法:

    1. 清理NuGet缓存:尝试清理NuGet缓存并重新安装NuGet包。可以通过在Visual Studio的"工具"菜单中选择"NuGet包管理器",然后选择"管理NuGet包解决方案"来打开NuGet包管理器。在"已安装"选项卡中找到相关的包,选择卸载并删除相关的文件。然后重新安装包。

    2. 更新NuGet:确保您使用的是最新版本的NuGet。可以通过在Visual Studio的"工具"菜单中选择"扩展和更新"来检查是否有可用的NuGet更新。如果有可用的更新,请安装并重启Visual Studio。

    3. 检查包依赖项:检查被安装的包的依赖项是否有冲突或不兼容的情况。您可以查看包的说明文档或在NuGet网站上查找相关信息,以确定是否有其他包或版本要求。

    4. 检查网络连接和代理设置:确保您的计算机可以正常访问NuGet包源。检查网络连接是否正常,并检查是否需要配置代理设置以便访问NuGet包源。

    5. 重建解决方案:有时,在出现错误后,重新构建整个解决方案可以解决问题。尝试在Visual Studio中选择"生成"菜单,然后选择"重新生成解决方案",然后再次尝试安装NuGet包。

    如果以上方法仍然无法解决问题,建议您将完整的错误信息和相关细节提交给NuGet的支持团队,或者在相关论坛或社区中寻求帮助。

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 11月13日
  • 创建了问题 11月9日