Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Bash] The second project doesn't generate “packages.lock.json” file after restoring project with command under solution path with enabling ‘RestorePackagesWithLockFile’ #13970

Open
CiciLi1 opened this issue Nov 29, 2024 · 4 comments
Labels
Area:RestoreRepeatableBuild The lock file features Found:ManualTests Style:PackageReference Type:Bug WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually.

Comments

@CiciLi1
Copy link

CiciLi1 commented Nov 29, 2024

NuGet Product Used

Visual Studio Package Management UI

Product Version

NuGet Client Dev\6.13.0.79

Worked before?

It is not a regression since it also reproes on D16.11\34601.136 with implicit NuGet Client 5.11.6.4 and D17.12\33527.113 with implicit NuGet Client 6.12.2.1.

Impact

It bothers me. A fix would be nice

Repro Steps & Context

Notes:  

  1. The repro rate is 100%. 

  2. This issue does not repro when you save the project in step 5 by clicking the “Save” button on the top of VS.

Repro Steps:   

  1. Create two “C# Class Library (.NET Framework 4.8.1)” projects.   

  2. Right-click the solution in Solution Explorer window and select "Manage NuGet Packages for Solutions…" menu item to open solution-level PM UI.   

  3. Click “Browse” tab and select “nuget.org” from “Package source” drop-down list.

  4. Install a package (e.g.Newtonsoft.Json) with “PackageReference” format into both projects.

  5. Right-click the project in Solution Explorer and select “Unload project”, click the “Save” button in prompt dialog box. (Both projects operate in the same way.)

  6. Set MSBuild property “RestorePackagesWithLockFile” to true in csproj file for every project.

<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>

  1. Reload projects and click “Tools -> Command Line -> Developer Command Prompt”

  2. Run restore command “msbuild /t:restore /v:d”.

Expected:   

It should have generated ‘packages.lock.json’ file alongside *.csproj file in every project.

Actual:   

The second project doesn’t generate “packages.lock.json” file as below screenshot: 
1129

Verbose Logs

No response

@kartheekp-ms
Copy link
Contributor

I am unable to reproduce the issue in 17.13 preview 3. I followed the repro steps mentioned in the issue description. lock file is generated for each project as shown below.
image
image

@CiciLi1
Copy link
Author

CiciLi1 commented Dec 9, 2024

Hi @kartheekp-ms, I verified this issue on vs 17.13 preview 3 35608.17 + NuGet Client Dev\6.13.0.93, it still repeo.
This issue does not repro when you save the project in step 5 by clicking the “Save” button on the top of VS, please save project by clicking the “Save” button in prompt dialog box in step 5.

@microsoft-github-policy-service microsoft-github-policy-service bot added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Dec 9, 2024
@Nigusu-Allehu
Copy link
Contributor

Hi @CiciLi1 , thank you for clarifying.

I clicked on the save button from the prompt only. However I was not able to reproduce the issue. As soon as I clicked save in the pop up window the lock file was generated
image

@microsoft-github-policy-service microsoft-github-policy-service bot added WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. labels Dec 14, 2024
@CiciLi1
Copy link
Author

CiciLi1 commented Dec 16, 2024

Hi @CiciLi1 , thank you for clarifying.

I clicked on the save button from the prompt only. However I was not able to reproduce the issue. As soon as I clicked save in the pop up window the lock file was generated image

Hi @Nigusu-Allehu, this bug only repro in solution with two projects, we see only one project in you screenshot above , could you please help to validate it in solution with two C# Class Library (.NET Framework 4.8.1) projects.

@microsoft-github-policy-service microsoft-github-policy-service bot added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:RestoreRepeatableBuild The lock file features Found:ManualTests Style:PackageReference Type:Bug WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually.
Projects
None yet
Development

No branches or pull requests

3 participants