NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): nuget.exe
NuGet version (x.x.x.xxx): 5.8.0.6930
OS version (i.e. win10 v1607 (14393.321)): Windows 10 v20H2
Worked before? If so, with which NuGet version: Yes, in version 5.5.1.6542
<PropertyGroup>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
nuget restore in the solution. The packages.lock.json files generated will be different.For 5.5.1.6542, I get this:
{
"version": 1,
"dependencies": {
".NETFramework,Version=v4.7.2": {
"Newtonsoft.Json": {
"type": "Direct",
"requested": "[12.0.3, 12.0.3]",
"resolved": "12.0.3",
"contentHash": "6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg=="
}
}
}
}
For 5.8.0.6930, I get this:
{
"version": 1,
"dependencies": {
"Any,Version=v0.0": {
"Newtonsoft.Json": {
"type": "Direct",
"requested": "[12.0.3, 12.0.3]",
"resolved": "12.0.3",
"contentHash": "6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg=="
}
}
}
}
As a consequence, restoring an existing project using locked mode in 5.8.0.6930 is resulting in failures, which broke our Azure Devops pipelines.
@fabio-muramatsu
Are you using a legacy project or an SDK based one?
Synced-up offline.
The project is legacy.
@dominoFire Can you take a quick look and verify this issue?
This sounds like a potential regression.
In my local devbox, I have the same result with both nuget.exe versions. Note that I'm using MSBuild 16.8 to run both versions.
Sample line
.\nuget.5.5.exe restore -verbosity detailed -MSBuildVersion 16.8 .\consoleapp1.sln
Output:
{
"version": 1,
"dependencies": {
".NETFramework,Version=v4.7.2": {
"Newtonsoft.Json": {
"type": "Direct",
"requested": "[12.0.3, 12.0.3]",
"resolved": "12.0.3",
"contentHash": "6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg=="
}
},
".NETFramework,Version=v4.7.2/win": {},
".NETFramework,Version=v4.7.2/win-x64": {},
".NETFramework,Version=v4.7.2/win-x86": {}
}
}
Use repro.ps1 to run the sample project.
@fabio-muramatsu Could you please provide a sample repro case?
Confirmed offline with @fabio-muramatsu . I can repro by using a Console App with packages installed using packages.config
Also happens when restoring with MSBuild 16.7:
.\nuget.5.8.exe restore -verbosity detailed -MSBuildVersion 16.7 .\TestRestore.sln
Thus, the bug might be on nuget.exe 5.8
@dominoFire could you also try this with nuget.exe 5.7?
@zkat This issue does not happen in nuget.exe 5.7
@nkolev92 - Would you please investigate based on @dominoFire's results?
Quick investigation:
I can confirm the problem. nuget.exe 5.7 works differently from nuget.exe 5.8.
I found a few other issues on the way.
Here are the 3 issues I am aware of:
PR out in https://github.com/NuGet/NuGet.Client/pull/3763.
Revisiting the above 2 issues(3rd one is the customer report):
nuget.exe restore modifies the lock file. - Turns out this is by design, although if you ask me a bad one, but it is what it is :) https://github.com/NuGet/Home/wiki/Packages.config-SHA-Validation#generating-the-lock-file
msbuild.exe restore /p:RestorePackagesConfig=true does not consider the lock files at all. - https://github.com/NuGet/Home/issues/10268
Hey @fabio-muramatsu
If possible, we'd appreciate it you can help us confirm that your issue is addresed by testing out https://dist.nuget.org/win-x86-commandline/v5.9.0-preview.2/nuget.exe
I had the same issue (Any,Version=v0.0) with nuget 5.8.0.6930 in GitHub Actions. Can confirm that 5.9.0-preview.2 fixes it 馃憤
@nkolev92 Sorry for the delay. I can confirm it's generating the right lock file using 5.9.0-preview.2. Thank you!
Most helpful comment
I had the same issue (
Any,Version=v0.0) with nuget 5.8.0.6930 in GitHub Actions. Can confirm that 5.9.0-preview.2 fixes it 馃憤