Skip to content

Add ability to disable the writing of the dependency graph spec file#7239

Open
jeffkl wants to merge 2 commits intodevfrom
dev-jeffkl-donotwritedependencygraphspec
Open

Add ability to disable the writing of the dependency graph spec file#7239
jeffkl wants to merge 2 commits intodevfrom
dev-jeffkl-donotwritedependencygraphspec

Conversation

@jeffkl
Copy link
Copy Markdown
Contributor

@jeffkl jeffkl commented Mar 27, 2026

Bug

Fixes: NuGet/Home#14114

Description

This will allow users to disable the writing of the DGSpec file since for large restores it can add a measurable amount of overhead. The guidance would be to only enable this option in a hosted build environment like:

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

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@jeffkl jeffkl self-assigned this Mar 27, 2026
@jeffkl jeffkl requested a review from a team as a code owner March 27, 2026 18:17
@jeffkl jeffkl requested review from jebriede and kartheekp-ms March 27, 2026 18:17
private static readonly byte[] SdkAnalysisLevel = Encoding.UTF8.GetBytes("SdkAnalysisLevel");
private static readonly byte[] UsingMicrosoftNETSdk = Encoding.UTF8.GetBytes("UsingMicrosoftNETSdk");
private static readonly byte[] UseLegacyDependencyResolverPropertyName = Encoding.UTF8.GetBytes("restoreUseLegacyDependencyResolver");
private static readonly byte[] RestoreDoNotWriteDependencyGraphSpecPropertyName = Encoding.UTF8.GetBytes("restoreDoNotWriteDependencyGraphSpec");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be a part of the no-op invalidation.

Like in theory, if I went from no to yes, I'd want the dgspec to be regenerated, but I know there's been attempts at using CI data to make local restores more efficient.

My only concern with not adding it though is it becoming out of date.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was worried about special casing any particular property, just in case that little detail is lost in the overall design. I could go either way...

@Frulfump
Copy link
Copy Markdown

Frulfump commented Mar 28, 2026

nit: The property in the PR description has a typo of Sepc instead of Spec

@jeffkl jeffkl requested a review from nkolev92 March 30, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to not write out dependency graph spec

3 participants