26

Some context:

I have 4 nuget packages with dependencies. They are all in pre-release mode, and they evolve from alpha to "stable" at their own pace. I want to be able to specify in the dependency definition that prereleases should be included, but when the "stable" version is available, it should update to the stable version.

In the NuGet Docs the rules for versioning are defining [ and ] to include the version number you specify and ( and ) to exlude the version number you specify.

Some examples on the impact of the versions in the nuspec file:

 <dependencies>
     <dependency id="MyComponent" version="1.2.0" />
 </dependencies>

==> This will install MyComponent 1.2.0 or higher. (not including prerelease 1.2.0-alpha)

 <dependencies>
     <dependency id="MyComponent" version="[1.2.0" />
 </dependencies>

==> This will install MyComponent 1.2.0 or higher. (not including prerelease 1.2.0-alpha)

 <dependencies>
     <dependency id="MyComponent" version="[1.2.0,2)" />
 </dependencies>

==> This will install MyComponent 1.2.0 until but not including version 2.0.0. (not including prerelease 1.2.0-alpha but includes prerelease 2.0.0-alpha)

Currently I set:

 <dependencies>
     <dependency id="MyComponent" version="(1.1.32767" />
 </dependencies>

But I find this a very ugly way and it does not really reflect the reality. (What if version 1.1.32767.1 exists?)

I would like to know how to specify that you wish to include prerelease versions in the minimum version?

5
  • So given version 1.1.32767, which versions do you want to include and which not? Feb 6, 2013 at 15:52
  • 1.2.0-alpha included, 1.2.0 included, 1.2.1 included etc. Excluded should be 1.1.xxx Feb 6, 2013 at 15:53
  • Where 1.1.xxx lower version or pre-release of 1.1.32767? Feb 6, 2013 at 15:57
  • Package X needs to depend on package Y version 1.2.0-alpha or higher. If I put 1.2.0 in dependency, the alpha will not be installed. Feb 6, 2013 at 16:01
  • The only way to get 1.2.0-alpha installed at the moment is by putting (1.1.32767 in the dependency. Feb 6, 2013 at 16:05

1 Answer 1

16

There's one important thing to note:

Depending on a pre-release makes the produced package itself also a prerelease.

It makes sense that by default pre-releases are ignored when defining the version range of dependencies because it would alter the version of the package being produced (without knowing which version to pick).

Ideally, the algorithm that checks for the version range of dependencies during installation performs a check whether the consumed package is a pre-release or not, and then either includes or excludes pre-release dependencies within the allowed version range.

I'm not sure whether this is currently the case, but looking at your question I don't think it is. You might want to log a feature request (or submit a pull request?) on http://nuget.codeplex.com

1
  • Your note is correct. I suspect indeed that this will have to be implemented Feb 6, 2013 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.