2016-01-27 77 views
12

我試圖將NuGet包Naos.Packaging.Nuget添加到VS2015項目Naos.Deployment.Core。兩者都是開源的。無法安裝nuget包; DNXCore依賴混淆

我得到這個錯誤:下面

Failed to add reference to 'System.Globalization'. Please make sure that it is in the Global Assembly Cache.

完整的輸出被粘貼。

令人困惑的是Naos.Deployment.Core是一個.net 4.5項目。 Naos.Packaging.Nuget也是如此。 Naos.Packaging.Nuget依賴 NuGet.Frameworks依賴於System.Globalization(據我所知,這是鏈中唯一的System.Globalization依賴)。但是,該依賴關係僅適用於DNXCore 5.0項目。

那麼爲什麼DNXCore在這裏關注問題呢?爲什麼我不能添加這個nuget包,我該如何修復它?

嘗試this approach但它沒有奏效。使用最新的VS 2015(更新1)和最新的nuget。

Attempting to gather dependencies information for package 'Naos.Packaging.NuGet.1.0.5' with respect to project 'Naos.Deployment.Core', targeting '.NETFramework,Version=v4.5' 
Attempting to resolve dependencies for package 'Naos.Packaging.NuGet.1.0.5' with DependencyBehavior 'Lowest' 
Resolving actions to install package 'Naos.Packaging.NuGet.1.0.5' 
Resolved actions to install package 'Naos.Packaging.NuGet.1.0.5' 
Removed package 'NuGet.Core.2.8.6' from 'packages.config' 
Successfully uninstalled 'NuGet.Core.2.8.6' from Naos.Deployment.Core 
Adding package 'Naos.Packaging.Domain.1.0.5' to folder 'C:\Users\suraj\Documents\GitHub\Naos.Deployment\packages' 
Added package 'Naos.Packaging.Domain.1.0.5' to folder 'C:\Users\suraj\Documents\GitHub\Naos.Deployment\packages' 
Added package 'Naos.Packaging.Domain.1.0.5' to 'packages.config' 
Successfully installed 'Naos.Packaging.Domain 1.0.5' to Naos.Deployment.Core 
Adding package 'NuGet.Configuration.3.3.0' to folder 'C:\Users\suraj\Documents\GitHub\Naos.Deployment\packages' 
Added package 'NuGet.Configuration.3.3.0' to folder 'C:\Users\suraj\Documents\GitHub\Naos.Deployment\packages' 
Install failed. Rolling back... 
Package 'NuGet.Configuration.3.3.0 : ' does not exist in project 'Naos.Deployment.Core' 
Removed package 'Naos.Packaging.Domain.1.0.5 : ' from 'packages.config' 
Package 'NuGet.Core.2.8.6' already exists in folder 'C:\Users\suraj\Documents\GitHub\Naos.Deployment\packages' 
Added package 'NuGet.Core.2.8.6' to 'packages.config' 
Removing package 'NuGet.Configuration.3.3.0 : ' from folder 'C:\Users\suraj\Documents\GitHub\Naos.Deployment\packages' 
Removed package 'NuGet.Configuration.3.3.0 : ' from folder 'C:\Users\suraj\Documents\GitHub\Naos.Deployment\packages' 
Removing package 'Naos.Packaging.Domain.1.0.5 : ' from folder 'C:\Users\suraj\Documents\GitHub\Naos.Deployment\packages' 
Removed package 'Naos.Packaging.Domain.1.0.5 : ' from folder 'C:\Users\suraj\Documents\GitHub\Naos.Deployment\packages' 
Failed to add reference to 'System.Globalization'. Please make sure that it is in the Global Assembly Cache. 
========== Finished ========== 
+0

這是一個dnx項目或經典的C#嗎?你使用'nuget'還是'dnu'來恢復? –

+0

這兩個項目都是經典的C#。使用nuget。 – SFun28

+0

您的項目是否針對.net4.5(非客戶端配置文件)?如果引用了'System.Globalization',你是否試圖先刪除它? nuget是最新的嗎?看來這個問題與'NuGet.Configuration.3.3.0'有關,你是否試圖用nuget安裝那個? – Stefan

回答

0

從頭開始重新創建Naos.Deployment.Core似乎已經解決了這個問題。

6

Naos.Packaging.NuGet 1.0.7對NuGet.Frameworks 3.3.0有依賴性。

NuGet.Frameworks 3.3.0System.Globalization 4.0.10有依賴性。這就是爲什麼它正在尋找System.Globalization。

嘗試一切後,包括添加System.Globalisation DLL作爲參考。在不使用控制檯的情況下,我使用了VS儀表板。

enter image description here

enter image description here

我決定ignore dependencies,也使用了選項overwrite conflicts這樣的Naos.Packaging.NuGet.1.0.7選項將自動preferenced。

enter image description here

安裝日誌:

Resolved actions to install package 'Naos.Packaging.NuGet.1.0.7' 
Resolved actions to install package 'Naos.Packaging.NuGet.1.0.7' 
Adding package 'Naos.Packaging.NuGet.1.0.7' to folder 'D:\VSpROJECTS\Naos.Deployment-master\Naos.Deployment-master\packages' 
Added package 'Naos.Packaging.NuGet.1.0.7' to folder 'D:\VSpROJECTS\Naos.Deployment-master\Naos.Deployment-master\packages' 
Added package 'Naos.Packaging.NuGet.1.0.7' to 'packages.config' 
Successfully installed 'Naos.Packaging.NuGet 1.0.7' to Naos.Deployment.Core.Test 
Package 'Naos.Packaging.NuGet.1.0.7' already exists in folder 'D:\VSpROJECTS\Naos.Deployment-master\Naos.Deployment-master\packages' 
Added package 'Naos.Packaging.NuGet.1.0.7' to 'packages.config' 
Successfully installed 'Naos.Packaging.NuGet 1.0.7' to Naos.Deployment.Core 
========== Finished ========== 

的的NuGet安裝並重建沒有錯誤。

enter image description here

所有其他依賴可以手動添加,對於其存在日誌列表中的進一步向下,或VS.內的容易檢查
經過更多的測試,我決定這是最好的選擇。無論出於什麼原因,它都沒有看到System.globalization,即使我引用它,它甚至會在輸出窗口中顯示重複的引用,但在安裝nuget時看不到引用。有太多的依賴關係來找出問題的根源。

另一點:nuget只有147下載,所以它可能是一個值得與作者報告的bug。

the docs

2 Dependency Behavior - this allows you to configure how NuGet will decide which versions of dependent packages will be installed. There are five options:

a. Ignore - This is usually a bad idea, as a package has dictated that it dependends on other packages and will require their contents to operate. You may choose to skip installing those packages.

.../...

3 File Conflict Options - If the package or any of its dependent packages being installed match a file already on disk, how should NuGet handle it?

.../...

c. Overwrite All - NuGet will overwrite any matching files in your project with those from the package

Spritely Recipees

佔用系統。全球化 在InheritedTypeJasonConverter

namespace Spritely.Recipes 
{ 
    using System; 
    using System.Collections.Concurrent; 
    using System.Collections.Generic; 
    using System.ComponentModel; 
    using System.Globalization; 
    using System.IO; 
    using System.Linq; 
    using System.Reflection; 
    using Newtonsoft.Json; 
    using Newtonsoft.Json.Linq; 

這也System.Collections中使用,這是試圖添加Naos.Packaging.NuGet獨立依賴性當還扔了一個錯誤。

如果我試圖單獨引用它們,它會顯示一個衝突,並有兩個引用。

包管理器也使用System.Globalization:

namespace Naos.Deployment.Core 
{ 
    using System; 
    using System.Collections.Generic; 
    using System.Globalization; 
    using System.IO; 
    using System.IO.Compression; 
    using System.Linq; 
    using System.Net; 
    using System.Text; 
    using System.Xml; 

的Naos.Packaging.NuGet.1.0.7安裝到以下項目沒有問題:

Successfully installed 'Naos.Packaging.NuGet 1.0.7' to Naos.Deployment.Contract 
Successfully installed 'Naos.Packaging.NuGet 1.0.7' to Naos.Deployment.MessageBus.Handler 
Successfully installed 'NuGet.PackageManagement 3.3.0' to Naos.Deployment.MessageBus.Contract 
Successfully installed 'Naos.Packaging.NuGet 1.0.7' to Naos.Deployment.CloudManagement 
Successfully installed 'Naos.Packaging.NuGet 1.0.7' to Naos.Deployment.Console 

我有直接接觸納奧斯關於這個問題,我正在等待他們的答覆。


以前的一些故障排除,以顯示使用ignore dependencies所需的絕望水平。

這是在一個新的Visual Studio項目上完成的。我誤解了作者的原意。

其中顯示的是removing包,它將刪除已安裝的軟件包,但需要更新以與您正在使用的Naos軟件包兼容。它沒有做到這一點。這可能是由於軟件包依賴於正在被移除的軟件包。在這種情況下'NuGet.Core.2.8.6'。或者它可能會在文件中造成一些輕微的損壞。因此,在嘗試安裝Naos並使用Naos所需的軟件包版本進行更新之前,您將不得不卸載軟件包,或者將其留在Naos中,然後添加它所需的依賴項。

這個問題是,如果你的軟件包依賴於'NuGet.Core.2.8.6',你可能還需要卸載它們。然後安裝Naos,然後重新安裝依賴於'NuGet.Core.2.8.6'的其他軟件包。

刪除NuGet.Core.2.8.6。試圖安裝Naos.Packaging.NuGet 1.0.7

Removed package 'NuGet.Core.2.8.6' from 'packages.config' Successfully uninstalled 'NuGet.Core.2.8.6' from Naos.Deployment.Core

之前,這可能意味着公司將不得不做的工作了進行卸載,重新安裝的,但隨後將允許通過的NuGet安裝了正確的依賴關係。

然後到達目錄並刪除對它的任何引用。

這是我的安裝與過時的版本:

PM> Install-Package Naos.Packaging.NuGet -Version 1.0.7 
Attempting to gather dependencies information for package 'Naos.Packaging.NuGet.1.0.7' with respect to project 'WebApplication2', targeting '.NETFramework,Version=v4.5.2' 
Attempting to resolve dependencies for package 'Naos.Packaging.NuGet.1.0.7' with DependencyBehavior 'Lowest' 
Resolving actions to install package 'Naos.Packaging.NuGet.1.0.7' 
Resolved actions to install package 'Naos.Packaging.NuGet.1.0.7' 
Removed package 'NuGet.Core.2.8.6' from 'packages.config' 
Successfully uninstalled 'NuGet.Core.2.8.6' from WebApplication2 
Adding package 'Naos.Packaging.Domain.1.0.7' to folder 'D:\Projects\WebApplication2\packages' 
Added package 'Naos.Packaging.Domain.1.0.7' to folder 'D:\Projects\WebApplication2\packages' 
Added package 'Naos.Packaging.Domain.1.0.7' to 'packages.config' 
Successfully installed 'Naos.Packaging.Domain 1.0.7' to WebApplication2 
Adding package 'NuGet.Configuration.3.3.0' to folder 'D:\Projects\WebApplication2\packages' 
Added package 'NuGet.Configuration.3.3.0' to folder 'D:\Projects\WebApplication2\packages' 
Added package 'NuGet.Configuration.3.3.0' to 'packages.config' 
.../... 
Added package 'Naos.Packaging.NuGet.1.0.7' to 'packages.config' 
Successfully installed 'Naos.Packaging.NuGet 1.0.7' to WebApplication2 
Removing package 'NuGet.Core.2.8.6' from folder 'D:\Projects\WebApplication2\packages' 
Removed package 'NuGet.Core.2.8.6' from folder 'D:\Projects\WebApplication2\packages' 

這是我的成功沒有任何需要刪除任何軟件包:

Attempting to gather dependencies information for package 'Naos.Packaging.NuGet.1.0.7' with respect to project 'WebApplication1', targeting '.NETFramework,Version=v4.5.2' 
Attempting to resolve dependencies for package 'Naos.Packaging.NuGet.1.0.7' with DependencyBehavior 'Lowest' 
Resolving actions to install package 'Naos.Packaging.NuGet.1.0.7' 
Resolved actions to install package 'Naos.Packaging.NuGet.1.0.7' 
Adding package 'Microsoft.Web.Xdt.2.1.1' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'Microsoft.Web.Xdt.2.1.1' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'Microsoft.Web.Xdt.2.1.1' to 'packages.config' 
Successfully installed 'Microsoft.Web.Xdt 2.1.1' to WebApplication1 
Adding package 'Naos.Packaging.Domain.1.0.7' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'Naos.Packaging.Domain.1.0.7' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'Naos.Packaging.Domain.1.0.7' to 'packages.config' 
Successfully installed 'Naos.Packaging.Domain 1.0.7' to WebApplication1 
Adding package 'NuGet.Configuration.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Configuration.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Configuration.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Configuration 3.3.0' to WebApplication1 
Adding package 'NuGet.ContentModel.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.ContentModel.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.ContentModel.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.ContentModel 3.3.0' to WebApplication1 
Adding package 'NuGet.Core.2.10.1' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Core.2.10.1' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Core.2.10.1' to 'packages.config' 
Successfully installed 'NuGet.Core 2.10.1' to WebApplication1 
Adding package 'NuGet.Logging.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Logging.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Logging.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Logging 3.3.0' to WebApplication1 
Adding package 'NuGet.Versioning.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Versioning.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Versioning.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Versioning 3.3.0' to WebApplication1 
Adding package 'NuGet.Frameworks.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Frameworks.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Frameworks.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Frameworks 3.3.0' to WebApplication1 
Adding package 'NuGet.LibraryModel.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.LibraryModel.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.LibraryModel.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.LibraryModel 3.3.0' to WebApplication1 
Adding package 'NuGet.Packaging.Core.Types.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Packaging.Core.Types.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Packaging.Core.Types.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Packaging.Core.Types 3.3.0' to WebApplication1 
Adding package 'NuGet.Packaging.Core.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Packaging.Core.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Packaging.Core.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Packaging.Core 3.3.0' to WebApplication1 
Adding package 'NuGet.Packaging.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Packaging.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Packaging.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Packaging 3.3.0' to WebApplication1 
Adding package 'NuGet.Protocol.Core.Types.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Protocol.Core.Types.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Protocol.Core.Types.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Protocol.Core.Types 3.3.0' to WebApplication1 
Adding package 'NuGet.Protocol.Core.v2.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Protocol.Core.v2.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Protocol.Core.v2.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Protocol.Core.v2 3.3.0' to WebApplication1 
Adding package 'NuGet.Protocol.Core.v3.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Protocol.Core.v3.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Protocol.Core.v3.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Protocol.Core.v3 3.3.0' to WebApplication1 
Adding package 'NuGet.Repositories.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Repositories.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Repositories.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Repositories 3.3.0' to WebApplication1 
Adding package 'NuGet.Resolver.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Resolver.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Resolver.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Resolver 3.3.0' to WebApplication1 
Adding package 'NuGet.RuntimeModel.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.RuntimeModel.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.RuntimeModel.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.RuntimeModel 3.3.0' to WebApplication1 
Adding package 'NuGet.Client.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Client.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Client.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Client 3.3.0' to WebApplication1 
Adding package 'NuGet.DependencyResolver.Core.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.DependencyResolver.Core.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.DependencyResolver.Core.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.DependencyResolver.Core 3.3.0' to WebApplication1 
Adding package 'NuGet.DependencyResolver.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.DependencyResolver.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.DependencyResolver.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.DependencyResolver 3.3.0' to WebApplication1 
Adding package 'NuGet.ProjectModel.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.ProjectModel.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.ProjectModel.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.ProjectModel 3.3.0' to WebApplication1 
Adding package 'NuGet.Commands.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Commands.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.Commands.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.Commands 3.3.0' to WebApplication1 
Adding package 'NuGet.ProjectManagement.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.ProjectManagement.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.ProjectManagement.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.ProjectManagement 3.3.0' to WebApplication1 
Adding package 'NuGet.PackageManagement.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.PackageManagement.3.3.0' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'NuGet.PackageManagement.3.3.0' to 'packages.config' 
Successfully installed 'NuGet.PackageManagement 3.3.0' to WebApplication1 
Adding package 'Naos.Packaging.NuGet.1.0.7' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'Naos.Packaging.NuGet.1.0.7' to folder 'D:\Projects\WebApplication1\packages' 
Added package 'Naos.Packaging.NuGet.1.0.7' to 'packages.config' 
Successfully installed 'Naos.Packaging.NuGet 1.0.7' to WebApplication1 

所以卸載使用較低版本的依賴。

如果這不起作用,請讓我知道。