将解决方案加载到VS2017中时无法更新Nuget模块15.4.1

时间:2017-11-08 15:09:17

标签: c# .net nuget .net-core visual-studio-2017

我有一个包含三个项目的解决方案,其中包括用户.net核心(v1.1)IdentityServer(1.1.0)和BrainTree(v3.7.0)等。我可以将解决方案加载到VS2017中,但没有一个依赖项是有效的。它们都有一个小的黄色三角形。

enter image description here

所以我右键单击Dependencies,选择manage packages并尝试安装它们。当我这样做时,我收到以下错误:

  

错误字典中没有给定的键。 0

在输出中我得到更多细节,但仍然不清晰:

Restoring packages for C:\Users\justin.hull\Source\Workspaces\Enterprise Repository\Web Applications\JPPAIdentityServer\src\JPPAMobileWebAPI\JPPAMobileAPI.csproj...
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at NuGet.Commands.TransitiveNoWarnUtils.ExtractTransitiveNoWarnProperties(RestoreTargetGraph targetGraph, String parentProjectName, HashSet`1 parentProjectWideNoWarn, Dictionary`2 parentPackageSpecificNoWarn, Dictionary`2 warningPropertiesCache)
   at NuGet.Commands.TransitiveNoWarnUtils.CreateTransitiveWarningPropertiesCollection(IEnumerable`1 targetGraphs, PackageSpec parentProjectSpec)
   at NuGet.Commands.RestoreCollectorLogger.get_TransitiveWarningPropertiesCollection()
   at NuGet.Commands.RestoreCollectorLogger.IsWarningSuppressed(IRestoreLogMessage message)
   at NuGet.Commands.RestoreCollectorLogger.LogAsync(IRestoreLogMessage message)
   at NuGet.Commands.RestoreCollectorLogger.LogAsync(ILogMessage message)
   at NuGet.Commands.Extensions.<LogMessagesAsync>d__3.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.Commands.RestoreCommand.<ValidateRestoreGraphsAsync>d__14.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.Commands.RestoreCommand.<ExecuteAsync>d__8.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.Commands.RestoreRunner.<ExecuteAsync>d__7.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.Commands.RestoreRunner.<CompleteTaskAsync>d__10.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.Commands.RestoreRunner.<RunWithoutCommit>d__3.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.DependencyGraphRestoreUtility.<PreviewRestoreAsync>d__2.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.<PreviewBuildIntegratedProjectActionsAsync>d__74.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.<PreviewInstallPackageAsync>d__65.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.<GetActionsAsync>d__13.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.UI.UIActionEngine.<>c__DisplayClass7_0.<<PerformActionImplAsync>b__0>d.MoveNext()
Time Elapsed: 00:00:02.6872367
========== Finished ==========

我做了一些搜索,虽然我找到了与Hololens和Unity有关的东西,但我没有使用过。我正在使用Studio的最新更新,我将.net核心升级到2.0以及此版本的Windows:

enter image description here

我尝试过根据某些想法手动更改global.json和csproj文件,但没有去那里。任何人都可以找到这个问题的解决方案,以便回到2015年,这不是一个可行的选择。

2 个答案:

答案 0 :(得分:0)

  

将解决方案加载到VS2017 15.4.1

时无法更新Nuget模块

您必须使用Visual Studio 2015 创建此.NET核心项目,然后使用Visual Studio 2017 打开它。 Visual Studio 2015的.net核心版本为1.0.0-preview,将项目升级到Visual Studio 2017后,目标框架将根据兼容性转换为.NET Standard 1.6,您可以查看{上的兼容性列表{3}}:

.NET Blog

然后检查有关enter image description hereMicrosoft.AspNetCore 1.1.0依赖关系信息,这两个信息都有依赖关系:

NETStandard.Library (>= 1.6.1) 

IdentityServer4.AccessTokenValidation 1.1.0

但是,将项目升级到Visual Studio 2017后,NETStandard.Library的默认版本为 1.6.0 ,导致不兼容。这就是你得到小黄色三角形的原因。

要解决此问题,您可以卸载软件包Microsoft.AspNetCore 1.1.0IdentityServer4.AccessTokenValidation 1.1.0,而不是安装Microsoft.AspNetCore 1.0.6 IdentityServer4.AccessTokenValidation 1.0.5 ,其依赖关系为NETStandard.Library (>= 1.6.0)

或者,如果您想继续使用Microsoft.AspNetCoreIdentityServer4.AccessTokenValidation的先前版本1.1.0,则可以将包NETStandard.Library从1.6更新为 2.0 Visual Studio 2015 上,然后使用Visual Studio 2017打开项目。

答案 1 :(得分:0)

我在使用NuGet Package版本4.4.0的VS2017 15.4.1版上遇到了同样的问题。这似乎是一个错误。解决方法是更改​​项目的程序集名称以匹配项目的实际名称。

有关详细信息,请参阅Nuget - Issue 6020

相关问题