-
I have 3 .Net projects Unfortunately, when the NuGet package for It says in the docs that floating versions are not supported. However, a floating version can easily be converted into a range can't it? What I want is for the NuGet package dependencies to be generated using an equivalent version range to the floating version specified in the package reference (rather than crystallized at whatever the latest version is when the NuGet package is built). Is there any way of doing this? If not, would it be a reasonable feature request (e.g. as an optional property on the package reference)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
https://docs.microsoft.com/en-us/nuget/concepts/package-versioning has more in depth documentation about versions, including ranges and floating versions. In short, version Next, NuGet is conservative when it comes to package compatibility. in the case of Projects that get packed and referenced by other projects are usually class libraries, not exe's. Therefore, if using 4.2.0 as the minimum bound for your packages is important to you, I suggest using 4.2.0 as your PackageReference version for your classlibs, and in your console/web/wpf/whatever app, the actual executable, in that project use 4.2.*. Finally, NuGet treats package downgrade (NU1605) as a warning, but [the .NET SDK elevates it to an error]( $(WarningsAsErrors);NU1605). This means your project can remove NU1605 from Also, your first paragraph makes it sound like A, B, and C are all in the same repo/solution. Why not make them all ProjectReferences? I don't understand why B would use C as a PackageReference instead of a ProjectReference. |
Beta Was this translation helpful? Give feedback.
https://docs.microsoft.com/en-us/nuget/concepts/package-versioning has more in depth documentation about versions, including ranges and floating versions.
In short, version
x
is equivalent to[x, )
, so technically it is a range, just with no upper bound. This means that4.1.*
is equilvant to[4.1.*, )
. If you want to upper bound it to 4.2.0, you should use[4.1.*, 4.2.0)
.Next, NuGet is conservative when it comes to package compatibility. in the case of
*
or1.*
, according to SemVer2 rules, package authors can add new APIs. Therefore, if your project uses1.*
, it's not safe to assume that a dependency of1.0
is the lower bound. Otherwise, when someone uses your package, they'd get the low…