Skip to content

Drop netstandard2.0 support from template engine#54041

Merged
MichaelSimons merged 1 commit intomainfrom
drop-netstandard-from-template-engine
Apr 22, 2026
Merged

Drop netstandard2.0 support from template engine#54041
MichaelSimons merged 1 commit intomainfrom
drop-netstandard-from-template-engine

Conversation

@MichaelSimons
Copy link
Copy Markdown
Member

@MichaelSimons MichaelSimons commented Apr 22, 2026

Summary

Drop netstandard2.0 from all template engine project TargetFrameworks. This is a breaking change for .NET 11.

Motivation

NuGet dropped netstandard support starting with version 7.0. Microsoft.TemplateEngine.Edge depends on NuGet packages (NuGet.Configuration, NuGet.Credentials, NuGet.Protocol), which made it increasingly difficult to maintain netstandard2.0 compatibility — the project had to pin these packages to older versions via VersionOverride using NugetNetStandardCompatibleVersion, and disable CentralPackageTransitivePinningEnabled to prevent transitive deps from being pulled up to the repo-wide 7.x versions.

After discussion with @baronfel, we agreed to make this breaking change in .NET 11.

Changes

  • 8 csproj files: Removed netstandard2.0 from TargetFrameworks (Abstractions, Core, Core.Contracts, Edge, IDE, Orchestrator.RunnableProjects, Utils, TemplateLocalizer.Core)
  • Edge.csproj: Removed VersionOverride="$(NugetNetStandardCompatibleVersion)" from NuGet package references and associated comment
  • eng/Versions.props: Removed NugetNetStandardCompatibleVersion property (no longer needed)
  • Directory.Build.props: Removed CentralPackageTransitivePinningEnabled=false workaround and associated comment
  • IsExternalInit.cs: Simplified polyfill guard from #if NETSTANDARD || NETFRAMEWORK to #if NETFRAMEWORK

Remaining targets

All 8 projects now target: $(NetMinimum), $(NetCurrent), $(NetFrameworkToolCurrent)

NuGet dropped netstandard support in 7.0, and Microsoft.TemplateEngine.Edge
depends on NuGet packages (NuGet.Configuration, NuGet.Credentials,
NuGet.Protocol). This makes it difficult to continue supporting netstandard2.0
in the template engine going forward.

This is a breaking change for .NET 11, agreed upon with @ChetHusk.

Changes:
- Remove netstandard2.0 from TargetFrameworks in all 8 template engine projects
- Remove NuGet VersionOverride pins in Edge.csproj (were pinning to an older
  netstandard-compatible NuGet version via NugetNetStandardCompatibleVersion)
- Remove NugetNetStandardCompatibleVersion property from eng/Versions.props
- Remove CentralPackageTransitivePinningEnabled=false workaround from
  src/TemplateEngine/Directory.Build.props (was needed to keep transitive NuGet
  deps on the older pinned version)
- Update IsExternalInit.cs polyfill guard from NETSTANDARD || NETFRAMEWORK
  to just NETFRAMEWORK

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 22, 2026 14:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes netstandard2.0 targeting from the TemplateEngine projects in the SDK repo, eliminating the need for older NuGet package pinning/workarounds and aligning TemplateEngine’s supported TFMs with the repo’s current NuGet package versions (breaking change intended for .NET 11).

Changes:

  • Drop netstandard2.0 from TargetFrameworks across 8 TemplateEngine projects.
  • Remove now-unnecessary NuGet package VersionOverride pinning in Microsoft.TemplateEngine.Edge.
  • Remove the related infrastructure/workarounds (NugetNetStandardCompatibleVersion property and TemplateEngine transitive pinning opt-out), and simplify the IsExternalInit polyfill guard.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/TemplateEngine/Tools/Microsoft.TemplateEngine.TemplateLocalizer.Core/Microsoft.TemplateEngine.TemplateLocalizer.Core.csproj Removes netstandard2.0 from multi-targeting list.
src/TemplateEngine/Shared/IsExternalInit.cs Restricts polyfill to NETFRAMEWORK only (since NETSTANDARD is no longer targeted).
src/TemplateEngine/Microsoft.TemplateEngine.Utils/Microsoft.TemplateEngine.Utils.csproj Removes netstandard2.0 from multi-targeting list.
src/TemplateEngine/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.csproj Removes netstandard2.0 from multi-targeting list.
src/TemplateEngine/Microsoft.TemplateEngine.IDE/Microsoft.TemplateEngine.IDE.csproj Removes netstandard2.0 from multi-targeting list.
src/TemplateEngine/Microsoft.TemplateEngine.Edge/Microsoft.TemplateEngine.Edge.csproj Removes netstandard2.0 target and drops NuGet package VersionOverride pinning.
src/TemplateEngine/Microsoft.TemplateEngine.Core/Microsoft.TemplateEngine.Core.csproj Removes netstandard2.0 from multi-targeting list.
src/TemplateEngine/Microsoft.TemplateEngine.Core.Contracts/Microsoft.TemplateEngine.Core.Contracts.csproj Removes netstandard2.0 from multi-targeting list.
src/TemplateEngine/Microsoft.TemplateEngine.Abstractions/Microsoft.TemplateEngine.Abstractions.csproj Removes netstandard2.0 from multi-targeting list.
src/TemplateEngine/Directory.Build.props Removes CentralPackageTransitivePinningEnabled=false workaround previously needed for netstandard/NuGet pinning.
eng/Versions.props Removes NugetNetStandardCompatibleVersion property (no longer referenced).

@baronfel baronfel added breaking-change Using this label will notify dotnet/compat and trigger a request to file a compat bug Area-Templates and removed Area-CodeFlow labels Apr 22, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Added needs-breaking-change-doc-created label because this PR has the breaking-change label.

When you commit this breaking change:

  1. Create and link to this PR and the issue a matching issue in the dotnet/docs repo using the breaking change documentation template, then remove this needs-breaking-change-doc-created label.
  2. Ask a committer to mail the .NET SDK Breaking Change Notification email list.

You can refer to the .NET SDK breaking change guidelines

@MichaelSimons
Copy link
Copy Markdown
Member Author

/ba-g known intermittent crash in net analyzer

@MichaelSimons MichaelSimons merged commit e259547 into main Apr 22, 2026
31 of 33 checks passed
@MichaelSimons MichaelSimons deleted the drop-netstandard-from-template-engine branch April 22, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Templates breaking-change Using this label will notify dotnet/compat and trigger a request to file a compat bug needs-breaking-change-doc-created

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants