1

I have created a nuget package for a library we use at my company. The library uses both Fluent NHibernate 1.3.0.717 and Structure Map 2.6.2.

Because some folks are using StructureMap 2.6.3, I created the dependencies of the package as:

<dependencies> <dependency id="FluentNHibernate" version="[1.3,)" /> <dependency id="structuremap" version="[2.6.2,)" /> </dependencies> 

And when the package shows up in NuGet it says that Structure Map >=2.6.2 is required. So far, so good.

Here's the issue: When I go to add this library to my project, it always installs Structure Map 2.6.3. It even uninstalls 2.6.2 from my project in order to do so.

I don't see any sign that structure map 2.6.3 is a dependency of FluentNHibernate (or any of its dependencies) so I am absolutely baffled as to why it will not simply add my library with the FluentNHibernate dependencies and leave my StructureMap 2.6.2 alone.

I don't know if this would have anything to do with it, but we host the packages on a UNC share.

2
  • try using just 2.6.2; See docs.nuget.org/docs/reference/version-range-specification Commented Sep 20, 2011 at 18:03
  • Unfortunately, that's not really going to work. Several of the consumers of this library are using 2.6.3. They are working without issue, it's only me using the same structure map version as the library who's having issues. Commented Sep 20, 2011 at 19:03

1 Answer 1

1

Read David Ebbo's blog series on NuGet Versioning and dependency resolution.

In short, we always pick the dependency with the lowest major and minor and highest build and revision number (based on the dependency's constraints). This is so that you automatically get bugs fixes (non breaking) when using a package as a dependency.

Sign up to request clarification or add additional context in comments.

3 Comments

I don't have to like it, but it is good to understand that everything is behaving as intended. Thanks.
Btw 1.3 == [1.3,) so you don't need [version,) it's implied.
If it is supposed to be picking the build with the highest version number, then it is broken. Case and point: Install MvcSiteMapProvider.MVC4. The version of MvcSiteMapProvider.Web that is installed is always the earliest patch. It is specified as 4.6.0 in the nuspec file, but it installs 4.6.1 on a new project even though 4.6.18 is available.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.