dotnet / dotnet/project-system
NuGet restore may happen multiple times for multi-target projects
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
Repro:
1, Open Roslyn solution, after everything settled, close VS.
2, Restart VS, open Roslyn solution again, notice it reaches intellisense ready state quickly after the solution explorer shows the tree
3, close the solution (keep VS open)
4, reopen Roslyn solution in the same VS session
Notice: it takes much longer times (minutes) to reach intellinsense ready state. Check asset files in the obj folder. In about 40 projects, they were modified. It doesn't happen when the solution is opened in a fresh booted VS. The content of those files are not changed.
The reason it happens is that for multiple target projects, NuGet restore happens for one of the target framework once. That removes all references for other target frameworks in those projects (and projects in their dependency closure). The rest target frameworks will be added later, and projects will eventually return to the correct state. But that leads a big perf hit, including extra number of design time builds. Also, if projects are not changed within the session, it will eliminate possibility of optimizations like skipping updating build cache, and break incremental build as well.
+ @drewnoakes
+ @panopticoncentral
Contributor guide
Assessment
This issue has not been assessed yet.