Skip to content

Set default TFM for Traversal to SDK version #610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MattKotsenas
Copy link
Member

@MattKotsenas MattKotsenas commented Mar 9, 2025

Fixes #602.

Defaulting to net45 feels odd, as it means folks are taking new dependencies on .NET Framework without realizing it. It can also lead to oddities like #602 where old defaults unexpectedly apply to newer projects.

This change allows the user to specify a particular version as before. Otherwise $(NETCoreAppMaximumVersion) becomes the default version.

I think this strikes a better balance, where users that care or need a specific version continue to do so, while those that consider Traversal projects more a facility of the SDK / build system get a more sensible default than a version released 13 years ago.

Fixes microsoft#602.

Defaulting to `net45` feels odd, as it means folks are taking _new_ dependencies on .NET Framework without realizing it. It can also lead to oddities like microsoft#602 where old defaults apply to newer projects.

This change allows the user to specify a particular version as before. However, otherwise `$(NETCoreAppMaximumVersion)` becomes the default version.

I think this strikes a better balance, where users that care or need a specific version continue to do so, while those that consider Traversal projects more a facility of the build system get a more modern default.
@MattKotsenas
Copy link
Member Author

As someone that's helping teams adopt traversal projects across an assortment of repos, this is something that comes up way more often than you might expect. The TFM shows up in binlogs and NuGet lock files, and devs often mistakenly think traversal projects are old or not well supported.

baronfel
baronfel previously approved these changes Mar 9, 2025
@MattKotsenas MattKotsenas requested a review from baronfel March 10, 2025 18:56
@MattKotsenas
Copy link
Member Author

/cc @AndyGerlicher for review, please. Thanks!

-->
<TargetFramework Condition="'$(TargetFramework)' == ''">net45</TargetFramework>
<TargetFramework Condition=" '$(TargetFramework)' == '' And '$(NETCoreAppMaximumVersion)' != ''">net$(NETCoreAppMaximumVersion)</TargetFramework>
Copy link
Member

Choose a reason for hiding this comment

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

What about something like netstandard1.0 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

That would be an improvement over net45, but it doesn't fix the linked bug.

Targeting old netstandard means we're still opt-ed out of modern defaults like defaulting to Release for publish and pack.

Copy link
Member Author

Choose a reason for hiding this comment

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

Another alternative would be to find a solution for the project templates. Then we could default to the current SDK version in the template.

I also prefer that option a bit less since it means every Traversal would set the TFM which clutters things a bit, but it'd be less magical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish on a Traversal target uses Debug configuration instead of Release by default
4 participants