gpt4 book ai didi

nuget 无法安装、更新或删除包 "same key has already been added."

转载 作者:行者123 更新时间:2023-12-04 14:41:36 28 4
gpt4 key购买 nike

我无法在我们的解决方案之一上安装/升级/卸载任何 nuget 包。据我所知,这与 PCL 无关,因为它在两台机器上是相同的。解决方案中的三个项目之一可以使用 nuget 更新,另外两个(较大的项目)失败并显示以下堆栈跟踪。

有没有人见过这个或知道如何解决它?我们在 packages.config 中没有重复的包名称,清除它们,文件夹和引用没有帮助,我们在管理员模式下运行并更新它。

虽然与这些 [1]、[2] 和 [3] 类似,但堆栈跟踪不匹配并且所有修复均无效。

[1] Visual Studio 2015, Nuget and “same key has already been added.”

[2] An item with the same key has already been added while Installing nuget package

[3] installing nuget package "same key has already been added."

Attempting to gather dependencies information for package 'jQuery.1.11.3' with respect to project 'www', targeting '.NETFramework,Version=v4.5'
Attempting to resolve dependencies for package 'jQuery.1.11.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'jQuery.1.11.3'
Resolved actions to install package 'jQuery.1.11.3'
Removed package 'jQuery.1.6.4' from 'packages.config'
Executing script file 'xxx\projectName\packages\jQuery.1.6.4\Tools\uninstall.ps1'...
Successfully uninstalled 'jQuery.1.6.4' from www
Adding package 'jQuery.1.11.3' to folder 'xxx\projectName\packages'
Added package 'jQuery.1.11.3' to folder 'xxx\projectName\packages'
Added package 'jQuery.1.11.3' to 'packages.config'
Executing script file 'xxx\projectName\packages\jQuery.1.11.3\tools\install.ps1'...
True


IsDirty : False
FileCount : 1
Name : jquery-1.11.3.intellisense.js
Collection : System.__ComObject
Properties : System.__ComObject
DTE : System.__ComObject
Kind : {6BB5F8EE-4483-11D3-8BCF-00C04F8EC28C}
ProjectItems : System.__ComObject
Object : System.__ComObject
ExtenderNames : {}
ExtenderCATID : {610D4615-D0D5-11D2-8599-006097C68E81}
Saved : True
ConfigurationManager :
FileCodeModel :
Document :
SubProject :
ContainingProject : System.__ComObject



Successfully installed 'jQuery 1.11.3' to www
Install failed. Rolling back...
Removed package 'jQuery 1.11.3' from 'packages.config'
Executing script file 'xxx\projectName\packages\jQuery.1.11.3\Tools\uninstall.ps1'...
True
Package 'jQuery.1.6.4' already exists in folder 'xxx\projectName\packages'
Added package 'jQuery.1.6.4' to 'packages.config'
Executing script file 'xxx\projectName\packages\jQuery.1.6.4\Tools\install.ps1'...
Removing package 'jQuery 1.11.3' from folder 'xxx\projectName\packages'
Removed package 'jQuery 1.11.3' from folder 'xxx\projectName\packages'
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at NuGet.PackageManagement.VisualStudio.BindingRedirectResolver.GetBindingRedirects(IEnumerable`1 assemblies)
at NuGet.PackageManagement.VisualStudio.BindingRedirectResolver.GetBindingRedirects(IEnumerable`1 assemblyPaths, AppDomain domain)
at NuGet.PackageManagement.VisualStudio.RuntimeHelpers.<AddBindingRedirectsAsync>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.VisualStudio.RuntimeHelpers.<AddBindingRedirectsAsync>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 NuGet.PackageManagement.VisualStudio.RuntimeHelpers.<AddBindingRedirectsAsync>d__0.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.VisualStudio.VSMSBuildNuGetProjectSystem.<<AddBindingRedirects>b__59_0>d.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.PackageManagement.VisualStudio.VSMSBuildNuGetProjectSystem.AddBindingRedirects()
at NuGet.ProjectManagement.MSBuildNuGetProject.PostProcessAsync(INuGetProjectContext nuGetProjectContext, CancellationToken token)
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 ==========

最佳答案

为了帮助其他遇到此问题的人,我发现这是因为我们的 dependentAssembly 在我们的 web.config 中没有 bindingRedirect(当使用 uCommerce 重定向他们的 dll 引用时会发生这种情况)例如

<dependentAssembly>
<assemblyIdentity name="Infralution.Licensing" publicKeyToken="3e7e8e3744a5c13f" />
<codeBase version="4.7.1.0" href="bin\ucommerce\Infralution.Licensing.dll" />
</dependentAssembly>

我已经检查了 nuget 更改日志并且有一个 similar thing reported here所以将等待最新版本,看看是否可以解决它。

它似乎也有一个别名引用的问题,我将报告它

关于nuget 无法安装、更新或删除包 "same key has already been added.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33110295/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com