12

I'm trying to add the NuGet package Naos.Packaging.Nuget to the VS2015 project Naos.Deployment.Core. Both are open source.

I'm getting this error:

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

The full output is pasted below.

What's confusing is that Naos.Deployment.Core is a .net 4.5 project. So is Naos.Packaging.Nuget. Naos.Packaging.Nuget has a dependency on NuGet.Frameworks which has a dependency on System.Globalization (as far as I can tell, this is the only dependency on System.Globalization in the chain). However, that dependency is only applicable for DNXCore 5.0 projects.

So why is the DNXCore concern an issue here? Why can't I add this nuget package and how can I fix it up?

Tried this approach but it didn't work. Using latest VS 2015 (update 1), with latest 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 ==========
Victor Hurdugaci
  • 28,177
  • 5
  • 87
  • 103
Suraj
  • 35,905
  • 47
  • 139
  • 250
  • Is this a dnx project or classic C#? Are you using `nuget` or `dnu` to restore? – Victor Hurdugaci Jan 29 '16 at 17:07
  • both projects are classic c#. using nuget. – Suraj Jan 29 '16 at 17:41
  • Is your project targeting .net4.5 (non client profile)? If `System.Globalization` is referenced, have you tried it to remove it first? Is nuget up to date? It seems the problem is related to `NuGet.Configuration.3.3.0` have you tried to install that one with nuget? – Stefan Jan 30 '16 at 17:48
  • It's a standard .NET 4.5 - I can't add the System.Globalization and if I manually update the reference in the csproj it shows as missing, however on the same machine in the same Visual Studio version for the same framework it will not show as a missing reference and was added correctly when installing the NuGet package. – wlscaudill Feb 02 '16 at 13:10
  • @MsYvette will do! I pinged the NuGet team on Twitter but haven't heard back. – Suraj Feb 11 '16 at 17:54

2 Answers2

6

The Naos.Packaging.NuGet 1.0.7 has a dependency on NuGet.Frameworks 3.3.0.

The NuGet.Frameworks 3.3.0 have a dependency on System.Globalization 4.0.10. Which is why it is looking for System.Globalization.

After trying everything, including adding the System.Globalisation dll as a reference. Without using the console, I used the VS dashboard.

enter image description here

enter image description here

I decided to ignore dependencies and also used the option to overwrite conflicts so the the Naos.Packaging.NuGet.1.0.7 options would be automatically preferenced.

enter image description here

The install log:

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 ==========

The nuget is installed and it rebuilds without errors.

enter image description here

All other dependencies can be added manually, for which there is a list in the log further down, or an easy check within VS.
After more testing I decided this is the best option. For whatever reason it is not seeing System.globalization, even if I reference it, and it will even show duplicated references in the output window, but fail to see the reference when installing the nuget. There are just too many dependencies to find the root cause of the issue.

Another point: the nuget has had only 147 downloads, so it may well be a bug worth reporting with the author.

From 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

Uses System.Globalization in the 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;

This also uses System.Collections, which is also throwing up an error when attempting to add the Naos.Packaging.NuGet dependencies independently.

If I attempt to reference these separately, it then shows a conflict, with having two references.

The package manager also uses 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;

The Naos.Packaging.NuGet.1.0.7 installs into the following projects without issue:

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

I have contacted Naos directly about this issue and am awaiting their reply.


Some previous trouble shooting to show the desperation levels required to use ignore dependencies.

This was done on a fresh Visual Studio Project. I misunderstood the authors original intent.

Where is shows it's removing packages, it's removing packages that are already installed, but need to be updated to be compatible with the Naos package you are using. It's failing to do this. This could be due to a package that has a dependency on the package that is being removed. In this case 'NuGet.Core.2.8.6'. Or it could be some minor corruption in your files. So you are going to have to uninstall the package before you attempt to install Naos and either update it with the package version Naos requires or leave it to Naos to then add the dependencies it requires.

This issue is, if you have packages that depend on 'NuGet.Core.2.8.6' you may need to uninstall these also. Then install Naos, then reinstall the other packages that have a dependency on 'NuGet.Core.2.8.6'.

Remove NuGet.Core.2.8.6. before trying to install 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

This might mean having to do a work out of uninstalls and re-installs, but it will then allow the correct dependencies to be installed by nuget.

Then got to the directories and remove any references to it.

This is my install with the outdated version:

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'

This is my successful without any needing to remove any 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

So uninstall any dependencies that use lower versions.

If this doesn't work please let me know.

0

re-creating Naos.Deployment.Core from scratch seems to have solved the problem.

Suraj
  • 35,905
  • 47
  • 139
  • 250