Skip to content

Target .NET 11 for NAOT-published generators - #2657

Draft
Sergio Pedri (Sergio0694) wants to merge 1 commit into
staging/3.0from
user/sergiopedri/naot-generators-net11
Draft

Sergio Pedri (Sergio0694) wants to merge 1 commit into
staging/3.0from
user/sergiopedri/naot-generators-net11

Conversation

@Sergio0694

Copy link
Copy Markdown
Member

Summary

Move the five Native AOT-published CLI build tools (the WinRT.*.Generator projects) to target .NET 11, and update the build script and CI to use the .NET 11 SDK. All other projects stay on .NET 10, and LangVersion stays at 14.0 (the C# 15 update will come in a separate PR).

Motivation

.NET 11 is now released, and the NAOT-published tools never load the projects they process into the runtime, so they can safely target a newer .NET version than the rest of the repo. In local benchmarks against real debug repros, the .NET 11 builds were slightly faster on wall time (about 3% for the interop generator, and 2-4% for the Windows SDK and merged projection generators), with similar memory use.

Changes

  • src/Directory.Build.props: add a ToolDotNetVersion property (net11.0) next to DotNetVersion, and use it for the *EffectiveToolsDirectory output paths.
  • src/WinRT.{Interop,Impl,Projection,Projection.Ref,WinMD}.Generator/*.csproj: target $(ToolDotNetVersion) instead of $(DotNetVersion).
  • src/WinRT.Internal/WinRT.Internal.csproj and src/Tests/*GeneratorTest/*.csproj: use $(ToolDotNetVersion) for the tool output paths, and add SkipGetTargetFrameworkProperties="true" to the tool ProjectReference items (a net10 project can't otherwise reference a net11 one), with comments updated and reflowed.
  • src/WinRT.Interop.Generator/Extensions/*.cs and src/WinRT.WinMD.Generator/Extensions/ModuleDefinitionExtensions.cs: replace FrozenDictionary<...>.Empty with [] to satisfy IDE0301, which the .NET 11 SDK flags and which fails Release builds.
  • src/build.cmd, build/AzurePipelineTemplates/*.yml and .github/workflows/product.yml: bump the build SDK from 10.0.402 to 11.0.100, and point the tool publish paths at net11.0.
  • .github/copilot-instructions.md: document the new tool target framework.

Move the five Native AOT CLI build tools to net11.0 via a new ToolDotNetVersion property, leaving all other projects on net10.0. Update build.cmd and the CI pipelines to use the .NET 11 SDK and the new tool output paths.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant