NuGet version range - always get the package with the highest revision number - nuget

I have declared the following package reference
<PackageReference Include="Abc.Defg" Version="9.9.5.*" />
With the desire that it should pick exactly a version 9.9.5 followed by the highest revision number it can find eg. 9.9.5.1234
Any package that doesn't start with 9.9.5. should be invalid eg. 9.9.6.0 or 9.9.4.0
I am getting the following message when I call nuget CLI command nuget restore but fail to understand how exactly to fix the warning and still get my desired result
WARNING: NU1604: Project dependency Abc.Defg does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
FYI, in case it makes a difference, the package version numer isn't declared directly as shown above but instead it is declared in a Directory.Build.props as a Property.
<MyVersion>9.9.5.*</MyVersion>
Which is than used as the following
<PackageReference Include="Abc.Defg" Version="$(MyVersion)" />
Is it possible to fix this with only one version number or do I need to change it to something like this
[9.9.5,9.9.6)
Which, if I am correct, translates to include 9.9.5.0 (0 can be omitted) and everything up to exclusively 9.9.6, so from 9.9.5.0 till 9.9.5.65534 should be valid.

The 9.9.5.* version extends the version range not just up, but down as well.
Lower version numbers that match this wildcard version constraint may not have the required "Abc.Defg" dependency.
The lower version number may need to be set to a version that covers this dependency, perhaps ...
(9.9.5.4, 9.9.5.*)

Related

malformed record data: github.com/lib/pq#v1.1.0/go.mod

i'm trying to get the go package using command go get gorm.io/driver/postgres
but the result is always like this
go get: gorm.io/driver/postgres#none updating to
gorm.io/driver/postgres#v1.1.0 requires
github.com/jackc/pgx/v4#v4.11.0 requires
github.com/jackc/pgconn#v1.8.1 requires
github.com/jackc/pgmock#v0.0.0-20190831213851-13a1b77aafa2 requires
github.com/jackc/pgtype#v0.0.0-20190828014616-a8802b16cc59 requires
github.com/jackc/pgx/v4#v4.0.0-pre1.0.20190824185557-6972a5742186 requires
github.com/jackc/pgtype#v0.0.0-20190824184912-ab885b375b90 requires
github.com/lib/pq#v1.1.0: verifying go.mod: github.com/lib/pq#v1.1.0/go.mod: malformed record data
i have cleaned my cache and still getting the same error. what should i do? thanks
You have an indirect dependency to [https://github.com/lib/pq/tree/v1.0.0] which has a malformed go mod file. The go version is not mentioned in that. The latest release is v1.10.2. There is nothing to do in your code since its indirect, you can use a version of your direct dependecy gorm.io/driver/postgres which uses an updated version of this lib/pq/tree library or raise an issue in the git for lib/pq/tree.

How to fix '[WARNING] The callable Microsoft.Quantum.Canon.InverseMod has been deprecated.' warning in Q#?

In IntegerFactorization Q# sample in Microsoft/Quantum repository, there isn't InverseMod function. But when I compile and run the code, it produces a number of warnings "The callable Microsoft.Quantum.Canon.InverseMod has been deprecated in favor of Microsoft.Quantum.Math.InverseModI.". How can I fix it?
There is no word InverseMod anywhere in Shor.qs file.
I expect warning is disappear. Plese help me TT
This was caused by the use of the deprecated function InverseMod in arithmetic libraries used by the IntegerFactorization project.
The project has dependencies on several NuGet packages, among them Microsoft.Quantum.Standard which provides standard library functions, including modular arithmetic. This package used the deprecated function in its version 0.6.1905.301, which caused this runtime warning. If you check the source code of the package in Microsoft/QuantumLibraries repository, you'll notice that this has been fixed two days ago, so with the next release of the NuGet package this warning will disappear.
Edit: This should be fixed in release 0.7.1905.3109. The samples repository has been updated to use the new release; if you get the latest version of the repository and try running the project again the warning should go away.

Nuget version restrictions

I'm using Nuget 4.3.0.4406 to pack an assembly with version 5.2.29.181212.8244-RC but I get
2018-12-12T08:44:02.8053309Z ##[error]The nuget command failed with
exit code(1) and error('5.2.29.181212.8244-RC' is not a valid version
string. Parameter name: value)
The versioning is NOT semver compliant but Nuget puts on restrictions and it's not clear which..? Does this mean Nuget not just supports SemVer but enforces it? I found this but I'm not sure what they mean with the SpecialVersion?
Basically I just want x.y.z.[date+buildid](-rc) where x.y.z are tied to a specification version so it can not be ommitted (we don't own that versioning).
Update
9.9.9.1812129999-rc works but 9.9.9.18121299999-rc and 9.9.9.9812129999-rc don't, where is this specified? (it's a numeric size limitation not a string length)
Taken from the NuGet Package Versioning Reference on Microsoft Docs:
With NuGet 4.3.0+ and Visual Studio 2017 version 15.3+, NuGet supports Semantic Versioning 2.0.0.
Certain semantics of SemVer v2.0.0 are not supported in older clients. NuGet considers a package version to be SemVer v2.0.0 specific if either of the following statements is true:
The pre-release label is dot-separated, for example, 1.0.0-alpha.1
The version has build-metadata, for example, 1.0.0+githash
For nuget.org, a package is defined as a SemVer v2.0.0 package if either of the following statements is true:
The package's own version is SemVer v2.0.0 compliant but not SemVer v1.0.0 compliant, as defined above.
Any of the package's dependency version ranges has a minimum or maximum version that is SemVer v2.0.0 compliant but not SemVer v1.0.0 compliant, defined above; for example, [1.0.0-alpha.1, ).
Of course you can find the Semmantic Versioning Specification at semver.org. I think you're especially interested in spec-item10:
Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata SHOULD be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85.
Your version would become something like x.y.z(-rc)+[date+buildid]

Why doesn't this Octopus Channel Rule match this package?

Here are sample version numbers for Nuget packages:
1.1.9-version3
1.1.8-version3
1.1.7-version3
Here are the channel rules for a Channel titled "Version3":
Version Range: [1.1.1-2.0.0]
Tag: version3
I can't make it any simpler - why are these packages not matching the channel rule? Even removing the version range doesn't seem to make any difference.
As per the Nuget versioning syntax, a range is defined by a comma-separator, the hyphen is for defining the pre-release tag.
Your version range should be [1.1.1,2.0.0]. The tag should be correct.

NuGet - Error when generating nuspec file

When I run nuget.exe pack for a project, I get the following error:
EXEC : warning : 1 issue(s) found with package 'Company.LibName'.
Issue: Specify version of dependencies.
Description: The version of dependency 'Newtonsoft.Json' is not specified.
Solution: Specifiy the version of dependency and rebuild your package.
(Specify typo is actually in the message.)
The offending line in the .nuspec file is the last line below:
<dependencies>
<group targetFramework="net45">
<dependency id="Newtonsoft.Json" />
However, I don't want specify a version. And I didn't think I needed to, see documentation:
https://docs.nuget.org/create/nuspec-reference#specifying-dependencies-in-version-2.0-and-above
What's the deal?
I think its just a warning and to be ignored.
It seems it only warns for one package, so although it appears to have singled-out Newtonsoft.Json as needing a version, if I reorder the dependencies, it's always the first one in the list (without a version) that invokes the warning.