开发者

Installing self-created Nuget package forces use of latest version of a dependency,

开发者 https://www.devze.com 2023-04-06 18:13 出处:网络
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.

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.

H开发者_JAVA百科ere'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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号