Skip to content

Add hook for importing .props file after .NET SDK props#45151

Merged
dsplaisted merged 2 commits intodotnet:release/9.0.2xxfrom
dsplaisted:after-netsdk-props-import
Dec 18, 2024
Merged

Add hook for importing .props file after .NET SDK props#45151
dsplaisted merged 2 commits intodotnet:release/9.0.2xxfrom
dsplaisted:after-netsdk-props-import

Conversation

@dsplaisted
Copy link
Copy Markdown
Member

Add a hook for a .props import after the .NET SDK props, which is useful for modifying the default item globs.

@ghost ghost added Area-ILLink untriaged Request triage from a team member labels Nov 26, 2024
@Sergio0694
Copy link
Copy Markdown
Contributor

Seems like this would also cover part of ##1696? The "after SDK .targets" part I mean.

@dsplaisted
Copy link
Copy Markdown
Member Author

Seems like this would also cover part of ##1696? The "after SDK .targets" part I mean.

Thanks for pointing that out, this does address part of that request.

FYI @jeffkl @baronfel

Also, any preference on the property naming? I went with AfterMicrosoftNetSdkProps here, while the issue linked suggests CustomAfterMicrosoftNETSdkProps.

@Sergio0694
Copy link
Copy Markdown
Contributor

My two thoughts on naming, we should use "AfterMicrosoftNETSdkProps", for three reasons:

  • It's consistent with "BeforeMicrosoftNETSdkTargets" and "AfterMicrosoftNETSdkTargets" which already exist
  • Like those other two, these specifically refer to the .NET SDK .props/.targets, not the MSBuild ones, like eg. "CustomBeforeMicrosoftCommonProps" does. Not using "Custom" makes it easy to tell the two groups apart.
  • There is also a functional difference between all "Custom" ones and these .NET SDK ones. The "Custom" ones are imported behind an Exists(...) check, meaning they do not support appending. Instead you must store the original value, overwrite it, then manually import the original value from your custom .props/.targets, if there was one. Whereas with these .NET SDK ones, you can just append your .props/.targets to the property, since all items are imported at once. Leaving the "Custom" prefix just for the MSBuild ones with this legacy behavior would also further make it easier to tell them apart.

@jeffkl
Copy link
Copy Markdown
Contributor

jeffkl commented Nov 27, 2024

I personally don't have a strong opinion one way or the other. My preference in general is to use the Custom prefix just out of habit. But honestly in this case, just having the functionality and it be documented is good enough for me, the naming is probably fine as-is.

Copy link
Copy Markdown
Contributor

@jeffkl jeffkl left a comment

Choose a reason for hiding this comment

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

Is there a good place to document this extensibility point?

Comment thread src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props Outdated
@Sergio0694
Copy link
Copy Markdown
Contributor

"Is there a good place to document this extensibility point?"

+1 to this. I could not find any existing docs clearly documenting all existing MSBuild/.NET SDK hooks 😅

@dsplaisted dsplaisted added the consider-for-documentation Issues where some of the information in the discussion may be appropriate to add to documentation label Nov 28, 2024
@dsplaisted
Copy link
Copy Markdown
Member Author

FYI @baronfel @marcpopMSFT, I added the consider-for-documentation tag

@dsplaisted
Copy link
Copy Markdown
Member Author

/azp run dotnet-sdk-public-ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@Sergio0694
Copy link
Copy Markdown
Contributor

@dsplaisted I tested this with the internal VS preview with the UWP SDK changes, works great! 🙂

@dsplaisted
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@dsplaisted
Copy link
Copy Markdown
Member Author

/azp run dotnet-sdk-public-ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@marcpopMSFT
Copy link
Copy Markdown
Member

@dsplaisted is this ready to go? Failures just look like known timeouts.

…props

Co-authored-by: Jeff Kluge <jeffkl@microsoft.com>
@dsplaisted dsplaisted merged commit 4b465ef into dotnet:release/9.0.2xx Dec 18, 2024
@marcpopMSFT marcpopMSFT removed Area-ILLink untriaged Request triage from a team member labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consider-for-documentation Issues where some of the information in the discussion may be appropriate to add to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants