Repository navigation
Conversation
With RestoreDoNotWriteDependencyGraphSpec=true the restore no longer writes <project>.nuget.dgspec.json, but GenerateTemporaryTargetAssembly still added it to the items it copies for the temporary WPF project. The unconditional Copy then failed with MSB3030 and the build stopped before markup compilation. Only add the dependency graph spec to the copied files when it is actually produced, leaving the default behaviour unchanged.
Member
|
I cherry-picked your changes into my WpfRuntime repo, the GitHub Actions CI build passed and produced a NuGet package. You can now install the following package in your project to test out / use your fix: <PackageReference Include="WpfLab.WpfRuntime" Version="1.1.0.1-test.20261130091851.cf0e0b" />See: WpfLab/WpfRuntime#48 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12108
Description
RestoreDoNotWriteDependencyGraphSpec=truestops NuGet from writing<project>.nuget.dgspec.jsonintoMSBuildProjectExtensionsPath.GenerateTemporaryTargetAssemblyinMicrosoft.WinFX.targetsnevertheless added that file to_SourceGeneratedNuGetPropsAndTargetsunconditionally, so theCopytask that mirrors the outer project's NuGet files for the temporary WPF project failed with:The build stopped before markup compilation, making the opt-in property unusable for WPF projects. The dgspec item is now only added when the restore is allowed to produce it, so the copy stays as before by default and is skipped when the file cannot exist.
Customer Impact
Anyone enabling
RestoreDoNotWriteDependencyGraphSpec(added for NuGet/Home#14114) on a WPF project gets a hard build failure with no workaround other than turning the property off again. Dotnet SDK 10.0.4xx is affected; there is no WPF-specific workaround because the failingCopylives in the WPF build targets.Regression
No. The property is new in the 10.0.4xx SDK and this target predates it; this is a missing interaction rather than a change in previously working behaviour. Projects that do not set the property copy the same files as before.
Testing
Reproduced and verified on macOS with .NET SDK 10.0.402,
EnableWindowsTargeting=true:dotnet new wpf -n wpfrepro, then<RestoreDoNotWriteDependencyGraphSpec>true</RestoreDoNotWriteDependencyGraphSpec>in the project file.dotnet buildbefore the change:Microsoft.WinFX.targets(408,7): error MSB3030: Could not copy the file ".../obj/wpfrepro.csproj.nuget.dgspec.json"— build failed.dotnet buildwith the patchedMicrosoft.WinFX.targets, same project and same SDK: Build succeeded, 0 warnings, 0 errors.obj/wpfrepro.csproj.nuget.dgspec.jsonis still generated and copied, so the existing behaviour is unchanged.The A/B used the identical project file and MSBuild invocation, with only the targets file switched, so the difference is attributable to this change. The task assembly was pinned to the SDK's own
PresentationBuildTasks.dll; that pinning is part of the throwaway test project only and is not in the diff.Not run: the repository's own
build.cmd/test.cmdon Windows, which needs a Windows host. The change is confined to twoItemGroups in the build targets and does not touch the task implementations.Risk
Low. The modification only narrows when the dgspec file is copied, under the same
IncludePackageReferencesDuringMarkupCompilationguard as before. When the property is unset (the default), the item list is identical to the current one, so existing builds follow exactly the previous code path.Microsoft Reviewers: Open in CodeFlow