Reputation: 12374
Say I create a new library, that wraps a rest service using RestSharp.
I create a nuspec and publish to a nuget feed, and the dependency lists as...:
...
<d:Dependencies>RestSharp:105.2.3</d:Dependencies>
...
Now I go and reference this package in a project, that already has a reference to RestSharp.
An update to RestSharp comes out, it is now version 1.6.1, and I update my project (but not the nuget package, which still lists 105.2.3 as a dependency).
It compiles and all is good.
However, when I try to run my library from the updated code, I get this error...:
System.IO.FileLoadException: Could not load file or assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
How can I make it clear in my nuget package, that I just want a MINIMUM of 105.2.3 - but any newer version would also be OK?
Upvotes: 0
Views: 717
Reputation: 4225
The snippet of the .nuspec
file you specified seems a bit odd to me. I've never seen the d
namespace and dependencies is a parent node which should contain a dependency
element for each seperate package you're targeting.
Then you mention that the new version is 1.6.1 which should be 106.1.0. Since the first part of the version (105 > 106) incremented, we're talking about a major increment. This normally means a breaking change in the public API. Usually a client cannot safely update a package with a major increment, without needing to change the software.
I think paragraph Cousin dependencies describes the problem you're running into.
In your case I'd suggest creating a new version of your 'wrapper' NuGet package. Update the dependency to RestSharp to require version 106.1.0, or at least the same version you're referencing directly. You could set the version attribute to for instance [106.1,107)
. That would mean that any version of 106.1 and above will do, until (exclusive) 107.x.
The version attribute of the dependency element allows a specific syntax for specifying a certain versioning strategy. Take a look at the NuSpec docs at Microsoft.
Here's also a list of possible version ranges with its corresponding syntax.
Upvotes: 1