Jul*_*les 27 c# visual-studio base-class-library nuget
我正在尝试安装Microsoft.Bcl.Build 1.0.14
努特回归
Installing 'Microsoft.Bcl.Build 1.0.14'. Successfully installed 'Microsoft.Bcl.Build 1.0.14'. Adding 'Microsoft.Bcl.Build 1.0.14' to LeadTracker.Calendar. Uninstalling 'Microsoft.Bcl.Build 1.0.14'. Successfully uninstalled 'Microsoft.Bcl.Build 1.0.14'. Install failed. Rolling back... An item with the same key has already been added.
Run Code Online (Sandbox Code Playgroud)
这也发生在json.net和其他软件包上.
我可以添加nancy和topshelf但不能添加json.net和bcl.
我在VS2012和2013中尝试过它.我也尝试卸载nuget并重新安装.我也尝试将nuget添加到空类库和空控制台应用程序中.始终返回相同的错误.
这也发生在json.net和其他软件包上.
我也试过没有包文件
任何想法最受赞赏.
这是命令和堆栈跟踪
PM> Install-Package Microsoft.Bcl.Build Installing 'Microsoft.Bcl.Build 1.0.14'. You are downloading Microsoft.Bcl.Build from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=329770. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device. Successfully installed 'Microsoft.Bcl.Build 1.0.14'. Adding 'Microsoft.Bcl.Build 1.0.14' to GoogleCalendarIntegration. Uninstalling 'Microsoft.Bcl.Build 1.0.14'. Successfully uninstalled 'Microsoft.Bcl.Build 1.0.14'. Install failed. Rolling back... Install-Package : An item with the same key has already been added. At line:1 char:1
+ Install-Package Microsoft.Bcl.Build
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], ArgumentException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPac kageCommand PM> $error[0].exception.stacktrace at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Collections.ObjectModel.KeyedCollection`2.AddKey(TKey key, TItem item) at System.Collections.ObjectModel.KeyedCollection`2.InsertItem(Int32 index, TItem item) at System.Collections.ObjectModel.Collection`1.Add(T item) at NuGet.CollectionExtensions.AddRange[T](ICollection`1 collection, IEnumerable`1 items) at NuGet.NetPortableProfileTable.BuildPortableProfileCollection() at NuGet.NetPortableProfileTable.get_Profiles() at NuGet.NetPortableProfileTable.GetProfile(String profileName) at NuGet.NetPortableProfile.Parse(String profileValue, Boolean treatOptionalFrameworksAsSuppor tedFrameworks) at NuGet.VersionUtility.IsPortableLibraryCompatible(FrameworkName projectFrameworkName, Framew orkName packageTargetFrameworkName) at NuGet.VersionUtility.IsCompatible(FrameworkName projectFrameworkName, FrameworkName package TargetFrameworkName) at NuGet.VersionUtility.<>c__DisplayClass8`1.<TryGetCompatibleItems>b__15(IGrouping`2 g) at System.Linq.Enumerable.WhereListIterator`1.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source) at NuGet.VersionUtility.TryGetCompatibleItems[T](FrameworkName projectFramework, IEnumerable`1 items, IEnumerable`1& compatibleItems) at NuGet.ProjectSystemExtensions.GetCompatibleItemsCore[T](IProjectSystem projectSystem, IEnum erable`1 items) at NuGet.ProjectManager.ExtractPackageFilesToProject(IPackage package) at NuGet.ProjectManager.AddPackageReferenceToProject(IPackage package) at NuGet.ProjectManager.Execute(PackageOperation operation) at NuGet.ProjectManager.Execute(IPackage package, IPackageOperationResolver resolver) at NuGet.ProjectManager.AddPackageReference(IPackage package, Boolean ignoreDependencies, Bool ean allowPrereleaseVersions) at NuGet.VisualStudio.VsPackageManager.<>c__DisplayClass83.<AddPackageReference>b__85() at NuGet.VisualStudio.VsPackageManager.RunProjectAction(IProjectManager projectManager, Action action) at NuGet.VisualStudio.VsPackageManager.AddPackageReference(IProjectManager projectManager, IPa ckage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions) at NuGet.VisualStudio.VsPackageManager.<>c__DisplayClass3.<InstallPackage>b__7() at NuGet.VisualStudio.VsPackageManager.RunSolutionAction(Action action) at NuGet.VisualStudio.VsPackageManager.InstallPackage(IProjectManager projectManager, String p ackageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions, B oolean skipAssemblyReferences, ILogger logger) at NuGet.VisualStudio.VsPackageManager.InstallPackage(IProjectManager projectManager, String p ackageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions, I Logger logger) at NuGet.PowerShell.Commands.InstallPackageCommand.InstallPackage(IVsPackageManager packageMan ager) at NuGet.PowerShell.Commands.InstallPackageCommand.ProcessRecordCore() at NuGet.PowerShell.Commands.NuGetBaseCommand.ProcessRecord() PM>
Run Code Online (Sandbox Code Playgroud)
Osc*_*alo 16
检查你的packages.config
Inside,检查你要安装的软件包.也许已经有一些参考,这避免了你可以安装新的.
如果找到引用,请从packages.config中删除引用并尝试再次安装该包.
有时我发生在package.config中是一些旧的引用,即使从Nuget包管理器中删除包后仍然留在那里.
如果没有,您可以删除整个packages.config,然后如果您可以选择让Nuget下载软件包,那么在构建解决方案时,将再次下载软件包.
我希望这有帮助
Han*_*ant 13
你的堆栈跟踪告诉故事,它 NuGet.NetPortableProfileTable.BuildPortableProfileCollection()
失败了.简而言之,它迭代了一组PCL参考装配配置文件,并且不止一次地遇到相同的配置文件.这是一个非常强烈的提示,表明您的c:\program files (x86)\reference assemblies\microsoft\framework\.netportable
目录内容已损坏.
有许多方法可以修复损坏:
Directory of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile
05/14/2014 01:01 PM <DIR> Profile1
05/14/2014 01:01 PM <DIR> Profile102
05/14/2014 01:01 PM <DIR> Profile104
05/14/2014 01:01 PM <DIR> Profile131
05/14/2014 01:01 PM <DIR> Profile136
05/14/2014 01:01 PM <DIR> Profile14
05/14/2014 01:01 PM <DIR> Profile143
05/14/2014 01:01 PM <DIR> Profile147
05/14/2014 01:01 PM <DIR> Profile154
05/14/2014 01:01 PM <DIR> Profile158
05/14/2014 01:01 PM <DIR> Profile18
05/14/2014 01:01 PM <DIR> Profile19
05/14/2014 01:01 PM <DIR> Profile2
05/14/2014 01:01 PM <DIR> Profile225
05/14/2014 01:01 PM <DIR> Profile23
05/14/2014 01:01 PM <DIR> Profile24
05/14/2014 01:01 PM <DIR> Profile240
05/14/2014 01:01 PM <DIR> Profile255
05/14/2014 01:01 PM <DIR> Profile3
05/14/2014 01:01 PM <DIR> Profile328
05/14/2014 01:01 PM <DIR> Profile336
05/14/2014 01:01 PM <DIR> Profile344
05/14/2014 01:01 PM <DIR> Profile36
05/14/2014 01:01 PM <DIR> Profile37
05/14/2014 01:01 PM <DIR> Profile4
05/14/2014 01:01 PM <DIR> Profile41
05/14/2014 01:01 PM <DIR> Profile42
05/14/2014 01:01 PM <DIR> Profile46
05/14/2014 01:01 PM <DIR> Profile47
05/14/2014 01:01 PM <DIR> Profile5
05/14/2014 01:01 PM <DIR> Profile6
05/14/2014 01:01 PM <DIR> Profile88
05/14/2014 01:01 PM <DIR> Profile92
05/14/2014 01:01 PM <DIR> Profile95
05/14/2014 01:01 PM <DIR> Profile96
Directory of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile
05/14/2014 12:59 PM <DIR> .
05/14/2014 12:59 PM <DIR> ..
05/14/2014 01:01 PM <DIR> Profile111
05/14/2014 01:01 PM <DIR> Profile259
05/14/2014 01:01 PM <DIR> Profile49
05/14/2014 01:01 PM <DIR> Profile7
05/14/2014 01:01 PM <DIR> Profile78
Directory of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.6\Profile
05/14/2014 12:59 PM <DIR> .
05/14/2014 12:59 PM <DIR> ..
05/14/2014 01:01 PM <DIR> Profile151
05/14/2014 01:01 PM <DIR> Profile157
05/14/2014 01:01 PM <DIR> Profile31
05/14/2014 01:01 PM <DIR> Profile32
05/14/2014 01:01 PM <DIR> Profile44
05/14/2014 01:01 PM <DIR> Profile84
Run Code Online (Sandbox Code Playgroud)
还有另一条路径会产生此错误。以下是重现它的方法:
(1)从VS项目(项目1)创建nuget包。
(2) 在引用项目 1 的项目 2 中,安装项目 1 nuget 包。
(3) 安装会失败,出现“same key”错误。
解决方案是在安装 nuget 包之前简单地删除对项目 1 的引用。
归档时间: |
|
查看次数: |
24732 次 |
最近记录: |