Skip to content

Conversation

@kzu
Copy link
Contributor

@kzu kzu commented Sep 1, 2025

Fixes #50573

Copilot AI review requested due to automatic review settings September 1, 2025 17:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issue #50573 by preventing duplicate imports of Microsoft.Common.props. The change adds a condition to check if Microsoft.Common.props has already been imported before attempting to import it again.

  • Adds a check for the MicrosoftCommonPropsHasBeenImported property to prevent duplicate imports

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

This PR is targeting main, which is now for .NET 11-facing work. If you intended to target .NET 10, either retarget this PR to release/10.0.1xx or make sure you backport the change to release/10.0.1xx after merging. See #50394 for more details.

@baronfel baronfel requested a review from a team September 2, 2025 00:09
@dsplaisted
Copy link
Member

With this change, UseArtifactsOutput wouldn't work if Microsoft.Common.props was imported before Microsoft.NET.Sdk's Sdk.props. This is because before it imports the common props it sets the following:

<CustomAfterDirectoryBuildProps>$(CustomAfterDirectoryBuildProps);$(MSBuildThisFileDirectory)UseArtifactsOutputPath.props</CustomAfterDirectoryBuildProps>

I'm not sure if there's a good solution.

@marcpopMSFT
Copy link
Member

Triage: @kzu not sure how to make this work. Why do you have to import common.props in your sdk?

@kzu
Copy link
Contributor Author

kzu commented Sep 16, 2025

@marcpopMSFT https://github.com/devlooped/SmallSharp/blob/main/src/SmallSharp/Sdk.props#L14C1-L15C1

In my case, I want to access MSBuildProjectExtensionsPath, for example. But besides my specific use case, this is the uniform pattern in all other targets, so for the sake of consistency, it would be important to implement it.

@kzu kzu force-pushed the ConditionalImportCommonProps branch from d693684 to 505a92c Compare September 16, 2025 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sdk.props improperly imports Microsoft.Common.props unconditionally

4 participants