Add option to not write out dependency graph spec #14114
Labels
Priority:3
Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.
Tenet:Performance
Performance issues
Type:Feature
NuGet Product(s) Involved
MSBuild.exe, dotnet.exe
The Elevator Pitch
After restore, NuGet writes out a dependency graph spec (dgspec) in the form of JSON. This file is only used in the scenario where you have loaded projects in a Visual Studio solution but a project that isn't loaded is referenced. In this case, NuGet loads the dgspec file to get information for restore.
However, in hosted build environments like Azure DevOps, there is no need to write this file since it isn't used. In a very large repository I tested out not writing this file and it reduced restore time by almost 20%.
We would not want to have this option on by default and instead would encourage people to set something based on their environment:
Additional Context and Details
Relevant code is at https://github.com/NuGet/NuGet.Client/blob/72ab0e05562bc8e19db1ce0c2630a80e0bd3ca28/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreResult.cs#L205C19-L209
The text was updated successfully, but these errors were encountered: