Open tapika opened 2 years ago
@tapika
Could you fill Subject/Topic
for your issue? it's missing now.
Also please correct semver version syntax, you're missing closing tag ]
or )
, correct syntax would be something like <dependency id="newtonsoft.json" version="[12.0.*, 13.0.1]" />
Updated ticket a bit to provide all information.
Also please correct semver version syntax, you're missing closing tag
]
or)
, correct syntax would be something like<dependency id="newtonsoft.json" version="[12.0.*, 13.0.1]" />
Did you try this one?
Floating versions (the *
) are only supported in PackageReference
. Packages themselves (nuspec file) can't use floating versions. NuGet chooses to make deterministic restore a priority. For this reason, package authors can't force package consumers into an "unreliable" build.
Floating versions (the
*
) are only supported inPackageReference
. Packages themselves (nuspec file) can't use floating versions. NuGet chooses to make deterministic restore a priority. For this reason, package authors can't force package consumers into an "unreliable" build.
My assumption was that .nuspec file allows asterisk, because if you build using .nuspec - it would contain asterisk. But apparently I was mistaken - nupkg build also saves incorrect information.
So this kind of config:
<dependencies>
<dependency id="packtwo" version="[1.0.*-*, 2.0.0)" />
</dependencies>
Gets saved into .nupkg as:
<dependency id="packtwo" version="[1.0.0-0, 2.0.0)" />
I think at very least nuget should report an error if nothing else. (Usage is asterisk is not allowed)
Also this link: https://stackoverflow.com/a/43202541/2338477
Was also misleading. Need to comment in there as well.
NuGet Product Used
NuGet.exe
Product Version
6.0
Worked before?
Never worked, I guess
Impact
It's more difficult to complete my work
Repro Steps & Context
Using
nuget pack ... <csproj path>
it's possible to build nuget package.
Next to project I'm using also
.nuspec
file to specify nuget package dependencies.So I have following files:
project.csproj
project.nuspec
In 2nd file, I'm additionally specifying nuget package dependencies.
This approach does work out of box.
But I wanted also to specify forward dependency, so my current package would pick up newer
packtwo
is that is available - for example bugfixes, etc...Then I've reconfigured dependency to be something like this:
But this does not work out of box. According to debugger -
end up somewhere at following call stack:
File:
NuGet.Client\src\NuGet.Core\NuGet.Packaging\PackageCreation\Xml\PackageMetadataXmlExtensions.cs
function: GetXElementFromPackageDependency
dependency.VersionRange
does contain information whether asterisk was used (e.g. checkOriginalString
) - but for some reason it's not saved into .nupkg/ ... nuspec file - so asterisk is not written intonuspec
file, resulting that asterisk cannot be used at all.Wondering what is the story behind this.
Why cannot be fixed ?