templating icon indicating copy to clipboard operation
templating copied to clipboard

Set TFM automatically during build

Open JanKrivanek opened this issue 2 years ago • 2 comments

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.

JanKrivanek avatar Jan 16 '23 13:01 JanKrivanek

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

YuliiaKovalova avatar Jan 25 '23 18:01 YuliiaKovalova

This is an example how MAUI is doing it: https://github.com/dotnet/maui/blob/c289db2bb7ff7e18f9c786e159f458045790c99b/src/Templates/src/Microsoft.Maui.Templates.csproj#L77

vlada-shubina avatar Jan 25 '23 21:01 vlada-shubina