Skip to content

Add option to not write out dependency graph spec #14114

Open
@jeffkl

Description

@jeffkl

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:

<PropertyGroup>
  <!-- Do not write out NuGet's dgspec file in our hosted build environment -->
  <RestoreWriteDependencyGraphSepc Condition="'$(ContinuousIntegrationBuild)' == 'true'">false</RestoreWriteDependencyGraphSepc>
</PropertyGroup>

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

Metadata

Metadata

Assignees

Labels

Priority:3Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.Tenet:PerformancePerformance issuesType:Feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions