Closed v-luzh closed 2 years ago
I didn't test with 16.11+5.11.1.17, but I did test with latest VS17.2 Int Preview and I can repro similar issue, but experience is bit different.
Above-described issue repro for netcore project, but not for packages.config
projects.
After I delete packages.lock.json
files from each project then restore again then same file regenerates for netcore
but not for packages.config
Could you please retest this with VS17?
@erdembayar I think the scenario is legacy package reference. So create a .NET Framework project, and when you install a package, select PackageReference.
@erdembayar I think the scenario is legacy package reference. So create a .NET Framework project, and when you install a package, select PackageReference.
PackageReference
is package name?
PackageReference is the project restore style.
.NET Core projects are PackageReference, but CPS based PackageReference, so different project system. Legacy PackageReference are old style projects, not SDK based, not CPS based, but the long project files that normally support packages.config by default.
Hi @erdembayar, It doesn't repro on 17.2 Preview 2 (Main\32228.143). The behavior on VS 17.2 is reasonable as the screenshot I uploaded in Expected section above.
I tried to repro with actual version (D16.11\32228.343 5.11.1.17) in description. I can see packages.lock.json
in FileExplorer, but not in VS.
Am I missing something?
@v-luzh does this issue repo on the latest version of 16.11?
Delete the lock file and run restore again.
Worth calling out how the file is being deleted.
In VS? Through File Explorer? The legacy project system doesn't support globbing, or automatic refreshing so it might be a red herring.
Hi @aortiz-msft Yes, it repro on the latest version of 16.11 (that's D16.11\32228.343 which we filed this bug on). Hi @nkolev92, we deleted the file on disc (in File Explorer) which you created manually in step 1. But 17.2 support automatic refreshing for the legacy project system as what I mentioned in Expected section above. Hi @erdembayar, we used C# Class Library (.NET Framework) project, not the C# Class Library (.NET Core).
Hi @aortiz-msft Yes, it repro on the latest version of 16.11 (that's D16.11\32228.343 which we filed this bug on). Hi @nkolev92, we deleted the file on disc (in File Explorer) which you created manually in step 1. But 17.2 support automatic refreshing for the legacy project system as what I mentioned in Expected section above. Hi @erdembayar, we used C# Class Library (.NET Framework) project, not the C# Class Library (.NET Core).
Yes, I'm using Library (.NET Framework) project
. But still couldn't repro, could you create gif animation please? Maybe there is something I'm missing.
If this is only about the file, there's nothing NuGet can/should do about it, only project system.
I imagine the same thing could apply if the files was any random text file.
Hi @erdembayar , please refer to below gif animation.
2 things in question.
packages.lock.file
manually? Once a project has packages.lock.json file in its root directory, the lock file is always used with restore even if the property RestorePackagesWithLockFile is not set. So another way to opt-in to this feature is to create a dummy blank packages.lock.json file in the project's root directory.
If there is no lock file on disk, and the project has not set the MSBuild property RestorePackagesWithLockFile
(this test scenario, from the title of this github issue) then no, VS/NuGet will not re-create the lock file.
Hi @erdembayar,
This is not a regression since it reproes on 16.10.0 Preview 1.0 [31025.218.d16.10]. Why it is OK on VS 17.2 Preview3 latest? I guess that's because VS improved the experience on how to show deleted file in Solution Explorer window on VS 17.2 Preview3. But we think it should be fix on 16.11 since the behavior in VS 17.2 Preview3 is more reasonable than before.
This sounds like something we should move to project team and let them decide how to handle it.
You can probably replace packages.lock.json with any non compile file and it's likely to repro. It doesn't seem like it has anything to do with lock files in particular.
Hi @nkolev92, I agree with you. Could you please help to confirm which area path should we move this bug to? I will move it later.
The path should be DevDiv\NET Tools\Project
@nkolev92 Thanks. Created a VS bug 1499811 to track this issue. I'm closing this one.
NuGet Product Used
Other/NA
Product Version
Release-5.11.x\5.11.1.17
Worked before?
No response
Impact
It bothers me. A fix would be nice
Repro Steps & Context
Details about Problem
VS Version: D16.11\32228.343 NuGet Version: Release-5.11.x\5.11.1.17 OS Version: Windows-11-Enterprise-21H2
Repro steps
Expected
The deleted packages.lock.json file should show as a deleted file or removed (that's what we do for .NET Core projects) in the Solution Explorer window. Below is what we show on 17.2 Preview 2 (Main\32228.143).
Actual
The deleted packages.lock.json file still shows as before in the Solution Explorer window as below.
Notes:
1.It is not a regression. We just think it should be fix on VS 16.11. 2.It doesn't repro on 17.2 Preview 2 (Main\32228.143).
Verbose Logs
No response