templating
templating copied to clipboard
Set TFM automatically during build
Is your feature request related to a problem? Please describe.
Current the TFM is set 'manually' in many of tempating project and sample/test/authoring templates. This require manual changes on each dotnet version update and is prone to errors.
Describe the solution you'd like.
Consider adding MSBuild property into the root Directory.Build.props file and reference this variable where needed
For template files this will need some extra trickery - as file will need to go through the build process - so they would then need to be referenced/run/packed from the build output location instead from the actual sources.
It might turn out the risk/reward ratio is not appealing for this suggestion though.
Note: in projects that are built we do use common TFM, but templates are static and it requires extra effort to change it. For now it is considered a low priority
This is an example how MAUI is doing it: https://github.com/dotnet/maui/blob/c289db2bb7ff7e18f9c786e159f458045790c99b/src/Templates/src/Microsoft.Maui.Templates.csproj#L77