尝试安装nuget获取“已添加具有相同密钥的项目”

时间:2015-12-25 15:49:43

标签: visual-studio-2015 nuget nuget-package

我正在尝试在我的项目中安装Autofac.MVC5(已在同一个项目中安装了Autofac nuget),我收到An item with the same key has already been added.错误。

这是输出:

Attempting to gather dependencies information for package 'Autofac.Mvc5.3.3.4' with respect to project 'Core\MyProj.Core.Factory', targeting '.NETFramework,Version=v4.6'
Attempting to resolve dependencies for package 'Autofac.Mvc5.3.3.4' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Autofac.Mvc5.3.3.4'
Resolved actions to install package 'Autofac.Mvc5.3.3.4'
For adding package 'Microsoft.AspNet.Razor.3.1.0' to project 'MyProj.Core.Factory' that targets 'net46'.
For adding package 'Microsoft.AspNet.Razor.3.1.0' to project 'MyProj.Core.Factory' that targets 'net46'.
Adding package 'Microsoft.AspNet.Razor.3.1.0' to folder 'F:\Development\MyProj\Server\packages'
Added package 'Microsoft.AspNet.Razor.3.1.0' to folder 'F:\Development\MyProj\Server\packages'
Added reference 'System.Web.Razor' to project 'MyProj.Core.Factory'.
Added package 'Microsoft.AspNet.Razor.3.1.0' to 'packages.config'
Successfully installed 'Microsoft.AspNet.Razor 3.1.0' to MyProj.Core.Factory
For adding package 'Microsoft.Web.Infrastructure.1.0.0' to project 'MyProj.Core.Factory' that targets 'net46'.
For adding package 'Microsoft.Web.Infrastructure.1.0.0' to project 'MyProj.Core.Factory' that targets 'net46'.
Package 'Microsoft.Web.Infrastructure.1.0.0' already exists in folder 'F:\Development\MyProj\Server\packages'
Added reference 'Microsoft.Web.Infrastructure' to project 'MyProj.Core.Factory'.
Added package 'Microsoft.Web.Infrastructure.1.0.0' to 'packages.config'
Successfully installed 'Microsoft.Web.Infrastructure 1.0.0' to MyProj.Core.Factory
For adding package 'Microsoft.AspNet.WebPages.3.1.0' to project 'MyProj.Core.Factory' that targets 'net46'.
For adding package 'Microsoft.AspNet.WebPages.3.1.0' to project 'MyProj.Core.Factory' that targets 'net46'.
Adding package 'Microsoft.AspNet.WebPages.3.1.0' to folder 'F:\Development\MyProj\Server\packages'
Added package 'Microsoft.AspNet.WebPages.3.1.0' to folder 'F:\Development\MyProj\Server\packages'
Added reference 'System.Web.Helpers' to project 'MyProj.Core.Factory'.
Added reference 'System.Web.WebPages.Deployment' to project 'MyProj.Core.Factory'.
Added reference 'System.Web.WebPages' to project 'MyProj.Core.Factory'.
Added reference 'System.Web.WebPages.Razor' to project 'MyProj.Core.Factory'.
Added package 'Microsoft.AspNet.WebPages.3.1.0' to 'packages.config'
Successfully installed 'Microsoft.AspNet.WebPages 3.1.0' to MyProj.Core.Factory
For adding package 'Microsoft.AspNet.Mvc.5.1.0' to project 'MyProj.Core.Factory' that targets 'net46'.
For adding package 'Microsoft.AspNet.Mvc.5.1.0' to project 'MyProj.Core.Factory' that targets 'net46'.
Adding package 'Microsoft.AspNet.Mvc.5.1.0' to folder 'F:\Development\MyProj\Server\packages'
Added package 'Microsoft.AspNet.Mvc.5.1.0' to folder 'F:\Development\MyProj\Server\packages'
Added reference 'System.Web.Mvc' to project 'MyProj.Core.Factory'.
Added package 'Microsoft.AspNet.Mvc.5.1.0' to 'packages.config'
Successfully installed 'Microsoft.AspNet.Mvc 5.1.0' to MyProj.Core.Factory
For adding package 'Autofac.Mvc5.3.3.4' to project 'MyProj.Core.Factory' that targets 'net46'.
For adding package 'Autofac.Mvc5.3.3.4' to project 'MyProj.Core.Factory' that targets 'net46'.
Adding package 'Autofac.Mvc5.3.3.4' to folder 'F:\Development\MyProj\Server\packages'
Added package 'Autofac.Mvc5.3.3.4' to folder 'F:\Development\MyProj\Server\packages'
Added reference 'Autofac.Integration.Mvc' to project 'MyProj.Core.Factory'.
Added package 'Autofac.Mvc5.3.3.4' to 'packages.config'
Successfully installed 'Autofac.Mvc5 3.3.4' to MyProj.Core.Factory
Added file 'app.config'.
Added file 'app.config'.
Added file 'app.config' to project 'MyProj.Core.Factory'.
Install failed. Rolling back...
Removed package 'Autofac.Mvc5 3.3.4' from 'packages.config'
Removed reference 'Autofac.Integration.Mvc.dll' from project 'MyProj.Core.Factory'
Removed package 'Microsoft.AspNet.Mvc 5.1.0' from 'packages.config'
Removed reference 'System.Web.Mvc.dll' from project 'MyProj.Core.Factory'
Removed package 'Microsoft.AspNet.WebPages 3.1.0' from 'packages.config'
Removed reference 'System.Web.Helpers.dll' from project 'MyProj.Core.Factory'
Removed reference 'System.Web.WebPages.Deployment.dll' from project 'MyProj.Core.Factory'
Removed reference 'System.Web.WebPages.dll' from project 'MyProj.Core.Factory'
Removed reference 'System.Web.WebPages.Razor.dll' from project 'MyProj.Core.Factory'
Removed package 'Microsoft.Web.Infrastructure 1.0.0' from 'packages.config'
Removed reference 'Microsoft.Web.Infrastructure.dll' from project 'MyProj.Core.Factory'
Removed package 'Microsoft.AspNet.Razor 3.1.0' from 'packages.config'
Removed reference 'System.Web.Razor.dll' from project 'MyProj.Core.Factory'
Removing package 'Autofac.Mvc5 3.3.4' from folder 'F:\Development\MyProj\Server\packages'
Removed folder 'F:\Development\MyProj\Server\packages\Autofac.Mvc5.3.3.4\lib\net45'.
Removed folder 'F:\Development\MyProj\Server\packages\Autofac.Mvc5.3.3.4\lib'.
Removed file 'Autofac.Mvc5.3.3.4.nupkg' from folder 'F:\Development\MyProj\Server\packages\Autofac.Mvc5.3.3.4'.
Removed folder 'F:\Development\MyProj\Server\packages\Autofac.Mvc5.3.3.4'.
Removed package 'Autofac.Mvc5 3.3.4' from folder 'F:\Development\MyProj\Server\packages'
Removing package 'Microsoft.AspNet.Mvc 5.1.0' from folder 'F:\Development\MyProj\Server\packages'
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.Mvc.5.1.0\lib\net45'.
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.Mvc.5.1.0\Content'.
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.Mvc.5.1.0\lib'.
Removed file 'Microsoft.AspNet.Mvc.5.1.0.nupkg' from folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.Mvc.5.1.0'.
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.Mvc.5.1.0'.
Removed package 'Microsoft.AspNet.Mvc 5.1.0' from folder 'F:\Development\MyProj\Server\packages'
Removing package 'Microsoft.AspNet.WebPages 3.1.0' from folder 'F:\Development\MyProj\Server\packages'
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.WebPages.3.1.0\lib\net45'.
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.WebPages.3.1.0\Content'.
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.WebPages.3.1.0\lib'.
Removed file 'Microsoft.AspNet.WebPages.3.1.0.nupkg' from folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.WebPages.3.1.0'.
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.WebPages.3.1.0'.
Removed package 'Microsoft.AspNet.WebPages 3.1.0' from folder 'F:\Development\MyProj\Server\packages'
Removing package 'Microsoft.AspNet.Razor 3.1.0' from folder 'F:\Development\MyProj\Server\packages'
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.Razor.3.1.0\lib\net45'.
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.Razor.3.1.0\lib'.
Removed file 'Microsoft.AspNet.Razor.3.1.0.nupkg' from folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.Razor.3.1.0'.
Removed folder 'F:\Development\MyProj\Server\packages\Microsoft.AspNet.Razor.3.1.0'.
Removed package 'Microsoft.AspNet.Razor 3.1.0' from folder 'F:\Development\MyProj\Server\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__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 ==========

我认为这与我的app.config有关 - 所以我尝试再次保存 - 但它没有用。

如果我打开一个新的控制台应用程序并安装该nuget,那么一切正常。就我的项目而言,它没有。

0 个答案:

没有答案