project-system: .csproj file not updated in Visual Studio until user does a Save All or closes solution
From @dougbu on February 25, 2017 0:38
Please read the following information before posting the issue.
Before posting the issue…
- If you’re having trouble with the NuGet client tools (the Visual Studio extension, NuGet.exe command line tool, etc.), you are in the right place.
Details about Problem
NuGet product used: VS UI Nuget Package Manager 4.0.0
dotnet.exe --version: 1.0.0-rc4-004883
VS version (if appropriate): 15.0.0+26222.1d15rel
OS version: Win10 v1607 (14393.696)
Worked before? Not positive but thing old package.config file was updated immediately.
Detailed repro steps so we can see the same problem
- Create a .NET Core Console solution
- Add a package e.g. Microsoft.EntityFrameworkCore.SqlServer v1.0.0
- Save everything
- Switch to a console window and confirm the .csproj file contains
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.0.0" />
- Open “Manage NuGet Packages…” again
- Update the package to a newer version e.g. v1.1.0 in above case
- Wait for restore to complete
- Switch to console window and…
Expected
Actual<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.0.0" />
- Save everything in Visual Studio
- Now Actual will match Expected.
Other suggested things
Verbose Logs
Please include verbose logs (NuGet.exe <COMMAND> -verbosity detailed | dotnet.exe <COMMAND> --verbose | etc…)
Sample Project
Very helpful if you can zip a project and paste into this issue!
Copied from original issue: NuGet/Home#4689
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 16 (11 by maintainers)
I expect to be able to move back and forth between the command line and Visual Studio without these strange synchronization failures.
As it is, Visual Studio misleads users. The least I’d expect is an indication saving the project is necessary.
@emgarten said in the original issue
project.json files were actually larger than .csproj files, at least in the converted ASP.NET repos. Nonetheless, the experience has regressed with the move to smaller files.
@collinprice As per above the behavior you are seeing with Manage NuGet packages is by design per the document save model that inside Visual Studio. The internal bug that I opened was about adding an unsaved indicator to better indicate that the project file is unsaved.
I’m taking from the bug you filed that you would prefer that Visual Studio always saved the project? If so I’ll turn it into actionable suggestion that folks can vote on - because the new one has the danger of being closed as by design.
@davkean Ahh that makes more sense. My team is in the process of upgrading our projects from package.config to PackageReference and this behaviour has only added to the confusion. Thanks for clarifying. If you could, please turn my post into an actionable suggestion.
Any movement on this action? Not seeing any flag, and it creates hell when you are switching between branches in source control when you forget to do a save all.