Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install package fails due to wrong resolving of dependency versions #2062

Closed
boernie opened this issue Feb 5, 2016 · 3 comments
Closed

Install package fails due to wrong resolving of dependency versions #2062

boernie opened this issue Feb 5, 2016 · 3 comments

Comments

@boernie
Copy link

boernie commented Feb 5, 2016

Hi there,

when trying to install my own package in a new project/solution, NuGet always tries to install (some of) its dependencies using the current last stable version - despite the fact, that I have listed all dependencies in the package's nuspec with "absolute versions" - they are defined with version = "[X.X]". Also, the package includes all recursive dependencies with the matching version. The definition of the dependencies in the nuspec-file lists them even in the required order.

Here's the dependency section of my nuspec-file for "MyPackage":

...
<dependencies>
  <dependency id="CommonServiceLocator" version="[1.3]" />
  <dependency id="Unity" version="[2.1.505]" />
  <dependency id="Unity.Interception" version="[2.1.505]" />
  <dependency id="EnterpriseLibrary.Common" version="[5.0.505]" />
  <dependency id="EnterpriseLibrary.ExceptionHandling" version="[5.0.505]" />
  <dependency id="EnterpriseLibrary.Logging" version="[5.0.505]" />
  <dependency id="EnterpriseLibrary.ExceptionHandling.Logging" version="[5.0.505]" />
  <dependency id="EnterpriseLibrary.Security.Cryptography" version="[5.0.505]" />
  <dependency id="Prism" version="[4.1.0]" />
  <dependency id="Prism.UnityExtensions" version="[4.1.0]" />
</dependencies>
...

By the way, I have also have tried to define the required version in the format "[X.X, X.X]" (where both "X.X" are the same), since I read in another posting that this might be helpful, but it did not make a difference in my situation.

I know that "MyPackage" is referencing quite old versions of its dependencies - a few of them (like "Prism") are also marked as deprecated on nuget.org - but my project has to use those versions, since it is part of a bigger product, that has these dependencies in those old versions, too.

"MyPackage" is available only in a "prerelease" version of "2.4.0-build9".

In addition to all that, I have installed all the above dependencies manually one-by-one using using the Package Manager Console.

If I now try to install "MyPackage", I still get the following error message (Using: Package Manager Console Host Version 3.3.0.167 [from VisualStudio 2015 Update 1]):

Install-Package : Unable to resolve dependencies. 'CommonServiceLocator 1.3.0' is not compatible with 'MyPackage 2.4.0-build9 constraint: CommonServiceLocator (= 1.3.0)', 'Prism.Composition 5.0.0 constraint: CommonServiceLocator (>= 1.2.0)'.

I am not referencing "Prism.Composition" in my nuspec-file. And also "Prism 4.1.0" does not depend on it - but "Prism 5.0.0" does. But again, I am not referencing "Prism 5.0.0" in my package and "Prism 4.1.0" is already installed and present in my project/solution.

So, why is NuGet trying to pick up a newer version of Prism and not the one installed and referenced from the package - and failing to install "MyPackage"?

It would be great, if one could point me to what I might be doing wrong or what explains this behavior.

Thanks a lot,
(Bernie).

Additional info - Dependencies of packages used in "MyPackage" as extracted from NuGet.org:

CommonServiceLocator 1.3:

  • (no dependencies)

Unity 2.1.505 (and 2.1.505.2):

  • CommonServiceLocator (>= 1.0.0)

Unity.Interception 2.1.505 (and 2.1.505.2):

  • Unity (>= 2.1.0)

EnterpriseLibrary.Common 5.0.505:

  • Unity.Interception (>= 2.1.0)

EnterpriseLibrary.ExceptionHandling 5.0.505:

  • EnterpriseLibrary.Common (>= 5.0.0)

EnterpriseLibrary.Logging 5.0.505 (and 5.0.505.1):

  • EnterpriseLibrary.Common (>= 5.0.0)

EnterpriseLibrary.ExceptionHandling.Logging 5.0.505:

  • EnterpriseLibrary.ExceptionHandling (>= 5.0.0)
  • EnterpriseLibrary.Logging (>= 5.0.0)

EnterpriseLibrary.Security.Cryptography 5.0.505:

  • EnterpriseLibrary.Common (>= 5.0.0)

Prism 4.1.0:

  • CommonServiceLocator (>= 1.0.0)

Prism.UnityExtensions 4.1.0:

  • Unity (>= 2.1.0)
  • Prism (>= 4.1.0)

Additional info - Dependencies of "Prism 5.0.0 (deprecated)" package:

Prism 5.0.0:

  • Prism.Composition (>= 5.0.0)
  • Prism.Interactivity (>= 5.0.0)
  • Prism.PubSubEvents (>= 1.0.0)
  • Prism.Mvvm (>= 1.0.0)

Additional info - Already installed packages in my project/solution (directories under solution's "packages" folder):

  • CommonServiceLocator.1.3
  • EnterpriseLibrary.Common.5.0.505.0
  • EnterpriseLibrary.ExceptionHandling.5.0.505.0
  • EnterpriseLibrary.ExceptionHandling.Logging.5.0.505.0
  • EnterpriseLibrary.Logging.5.0.505.1
  • EnterpriseLibrary.Security.Cryptography.5.0.505.0
  • Prism.4.1.0.0
  • Prism.UnityExtensions.4.1.0.0
  • Unity.2.1.505.2
  • Unity.Interception.2.1.505.2
@emgarten
Copy link
Member

emgarten commented Feb 5, 2016

Would you provide a project and the packages needed to repro this?

@boernie
Copy link
Author

boernie commented Feb 8, 2016

Hi "Emgarten",

while trying to provide you with a project and packages, I found that the problem must be related to my package and dependency design - and not in how NuGet is performing its package resolution.

I cannot provide you with the real packages, since they are part of my company's production code - and with "artificial" packages and projects the problems do not occur.

So, I would like to apologize to alarm you. Although, I was spending a lot of time debugging the issues before I wrote the issue above - but maybe I was blind too deep into the story...

Thanks for your effort trying to look into this.

Cheers,
(Bernie).

@boernie boernie closed this as completed Feb 8, 2016
@emgarten
Copy link
Member

emgarten commented Feb 8, 2016

@boernie let me know if you find any issues with how NuGet resolves your packages.

NuGet can return very poor error messages in some scenarios where the package constraints invalid, or the packages already in the solution are not valid today. There is an issue tracking it here: #1373

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants