Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused item metadata after copy/paste in Visual Studio #5814

Merged
merged 2 commits into from
Mar 30, 2022

Conversation

ThomasGoulet73
Copy link
Contributor

Fixes #5461

Description

Removes unused item metadata that are automatically added to the project after copy/pasting a xaml file in Visual Studio.

Customer Impact

None.

Regression

No.

Testing

Tested locally by modifying my installed SDK to apply the changes in this PR. It fixed the addition of <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> on copy/paste.

Risk

This PR will add <Generator>MSBuild:Compile</Generator> and <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> to any Page or ApplicationDefinition item even if globbing is disabled or if they are added manually.

@ThomasGoulet73 ThomasGoulet73 requested a review from a team as a code owner December 14, 2021 03:48
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Dec 14, 2021
@ghost ghost requested review from fabiant3, ryalanms and SamBent December 14, 2021 03:49
@vishalmsft
Copy link
Contributor

@ThomasGoulet73 Thank you for providing the fix.
Partially the risk portion can be mitigated, if ItemDefinitionGroup is also put under the condition
<ItemDefinitionGroup Condition=" '$(_EnableWindowsDesktopGlobbing)' == 'true' ">

The second portion, where it adds those attributes to any ApplicationDefinition \ Page, need to learn more about implication of that.

The SubType gets removed, if adding following attribute to ItemDefinitionGroup. Not sure, why this can be wrong or right.
<SubType>Designer</SubType>

@ThomasGoulet73
Copy link
Contributor Author

@vishalmsft I added <SubType>Designer</SubType> and _EnableWindowsDesktopGlobbing condition. I did some testing and I think adding <SubType>Designer</SubType> is fine. I looked at other XAML frameworks and I found out that Uno Platform and Avalonia adds it:
https://github.com/unoplatform/uno/blob/master/src/SolutionTemplate/UnoSolutionTemplate/Shared/UnoQuickStart.Shared.projitems#L45
https://github.com/AvaloniaUI/Avalonia/blob/master/packages/Avalonia/AvaloniaBuildTasks.props#L8

@vishalmsft
Copy link
Contributor

@ThomasGoulet73 Thank you references from other platforms. This helps expect no side-effects.

@vishalmsft
Copy link
Contributor

This has been queued for test pass. Tests will be mainly about build of the Sample WPF application.

@singhashish-wpf singhashish-wpf merged commit 48feca3 into dotnet:main Mar 30, 2022
@ThomasGoulet73 ThomasGoulet73 deleted the issue-5461 branch March 30, 2022 17:10
@ghost ghost locked as resolved and limited conversation to collaborators Apr 29, 2022
@ghost ghost assigned ThomasGoulet73 May 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy/paste in Visual Studio modifies project when using item globbing
4 participants