m.g*_*iri 1 c# nuget nuget-package visual-studio-2015
我在vs 2015中遇到了nuget包管理器的问题.像Unity这样的软件包安装没有问题.像EF这样的软件包在安装时遇到了问题.像Automapper这样的软件包有同样的问题,但是当我安装了这个软件包的另一个版本时,安装得很好.
这是输出:
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.Protocol.Core.v3.GlobalPackagesFolderUtility.<AddPackageAsync>d__1.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`1.GetResult()
at NuGet.Protocol.Core.v3.DownloadResourceV3.<GetDownloadResourceResultAsync>d__4.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.PackageDownloader.<GetDownloadResourceResultAsync>d__1.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__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NuGet.PackageManagement.NuGetPackageManager.<ExecuteNuGetProjectActionsAsync>d__42.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.UI.UIActionEngine.<ExecuteActionsAsync>d__5.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.UI.UIActionEngine.<PerformActionAsync>d__3.MoveNext()
========== Finished ==========
Run Code Online (Sandbox Code Playgroud)
小智 17
Visual Studio 2022中仍然存在同样的问题。解决方案:
添加键=“nuget.org”值=“https://api.nuget.org/v3/index.json”协议版本=“3”
并删除'protocolVersion =“3”'
小智 9
这是使用Visual Studio 2015中使用的新协议(版本3)nuget的常见问题.它具有多个nuget包,例如Microsoft.Owin 3.0.1.要解决这个问题,请访问:
C:\Users\<your user name>\AppData\Roaming\NuGet
Run Code Online (Sandbox Code Playgroud)
编辑XML配置文件,注释协议3的行:
<!-- add key = "nuget.org" value = "https://api.nuget.org/v3/index.json" protocolVersion = "3" /-->
<add key = "nuget.org" value = "https://www.nuget.org/api/v2/" />
Run Code Online (Sandbox Code Playgroud)
版本2的维护设置.保存并重新启动visual studio 2015.您现在应该可以毫无问题地恢复nuget包.
| 归档时间: |
|
| 查看次数: |
7555 次 |
| 最近记录: |