Support for .targets was added 2021.
But MS current recommendation is to place in Directory.Build.props, which .csproj auto-include and CAN override.
- .props should be supported, or better yet, the code (which is a one line to test for .csproj/.targets) should see if the file is XML with tag.
- Directory.Build.props, if exist at top level and 'dotnet version' run at top level (where .git is) should be used automatically (no -f required)
more info on Directory.Build.props:
https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory?view=vs-2022