Repository navigation
Don't change the namespace of an existing windowsSettings element when adding supportedArchitectures - #15712
Draft
OvesN wants to merge 1 commit into
Draft
Don't change the namespace of an existing windowsSettings element when adding supportedArchitectures#15712OvesN wants to merge 1 commit into
OvesN wants to merge 1 commit into
Conversation
…AddToWin32Manifest Adding xmlns to an unprefixed windowsSettings element moved it out of the asm.v3 namespace, invalidating it and its existing settings. The 2024 namespace is now declared only on supportedArchitectures. Fixes dotnet#15543 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2e2dfea7-0c44-4356-9857-85a4d3bb3626
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change preserving existing windowsSettings namespaces.
No open issues 🎉
What changed in this PR
Fixes #15543 by preserving the namespace of existing windowsSettings elements when MSBuild adds supportedArchitectures for PreferNativeArm64=true.
Changes:
- Removes the default namespace assignment that invalidated unprefixed
windowsSettings. - Updates the regression fixture to cover namespace inheritance from
application. - Updates expected outputs so the 2024 namespace is declared on
supportedArchitectures.
| File | Description |
|---|---|
src/Tasks/AddToWin32Manifest.cs |
Preserves the existing windowsSettings namespace. |
src/Tasks.UnitTests/TestResources/Manifests/testManifestNoPrefixes.manifest_expected |
Expects inherited namespace preservation and a child-local namespace declaration. |
src/Tasks.UnitTests/TestResources/Manifests/testManifestNoPrefixes.manifest |
Reproduces the unprefixed manifest shape from the issue. |
src/Tasks.UnitTests/TestResources/Manifests/default.win32manifest_expected |
Updates namespace placement for newly created settings. |
src/Tasks.UnitTests/TestResources/Manifests/buildIn.manifest_expected |
Updates namespace placement for prefixed settings. |
Review effort: Balanced
This branch has not been deployed
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.
Related issue(s):
Fixes #15543
Context
With
PreferNativeArm64=true,AddToWin32Manifestaddedxmlns="http://schemas.microsoft.com/SMI/2024/WindowsSettings"to an existingwindowsSettingselement that had noxmlnsattribute. When that element is unprefixed and inheritsurn:schemas-microsoft-com:asm.v3from<application>(the shape used by the VSapp.manifesttemplate), this movedwindowsSettingsinto the wrong namespace. Windows then ignored both the newsupportedArchitecturesand existing settings such asdpiAwareness.Changes Made
xmlnstowindowsSettings.supportedArchitecturesis already created in the 2024 namespace, so the writer declares it on that element.testManifestNoPrefixes.manifestto the shape from the issue (unprefixedwindowsSettingswithout its ownxmlns). Previously it already had the 2024xmlns, so it did not cover this case.asmv3:windowsSettings:xmlnsnow appears onsupportedArchitecturesinstead ofwindowsSettings. The namespace of each element is unchanged.Compatibility
For newly created or prefixed
windowsSettings, the generated manifest is semantically identical; only where the 2024 namespace is declared changes. For an unprefixedwindowsSettingsthat inheritsasm.v3, the output is now valid.Testing
.\build.cmd -v quiet— succeeded.dotnet test src\Tasks.UnitTests\Microsoft.Build.Tasks.UnitTests.csproj --no-build --filter-class Microsoft.Build.Tasks.UnitTests.AddToWin32Manifest_Tests— passed, 26/26 (net11.0 and net481, including the Windows E2E tests that read the embedded manifest).PreferNativeArm64=trueand the manifest from the issue using the bootstrapped MSBuild; the generated manifest matches the issue's expected output.