Skip to content

Releases: mono/t4

v3.0.0

24 Oct 19:01
Compare
Choose a tag to compare

Overview

The major change in Mono.TextTemplating 3.0.0 is the addition of a new T4.BuildTools package. This contains MSBuild targets for build-time text transformations. Although fully featured, it has not been extensively tested and further feedback would be appreciated. These targets are documented in the package README.md and include a bundled schema for the MSBuild Editor. These targets are fully integrated into the Visual Studio design time build and mechanisms for executing targets on save, making it straightforward to migrate to Mono.TextTransform from the VS T4 engine.

Although there are no API breaking changes, the major version was bumped following SemVer rules as there are multiple changes to assembly loading rules that could result in breaking behavioral changes in some cases.

  • Fixed assembly resolution bugs specific to the AssemblyLoadContext codepath used on .NET Core. It should now be consistent with the assembly resolution behavior with AppDomain on .NET Framework.
  • Added a DisableAssemblyLoadContext host option to opt out of AssemblyLoadContext usage.
  • Assemblies known to the host now take precedence over identically-named assemblies passed to the generator. This prevents issues where a reference assembly passed to the host would fail to load at runtime.
  • When the host specifies to use the current AppDomain for template execution, then the AppDomain codepaths will be skipped entirely. This optimization may lead to changes in assembly loading behavior.

There are also miscellaneous bug fixes and improvements to compatibility with newer .NET and C# version:

  • Handling of the C# language version has been reworked (1, 2). The language version and runtime version are now decoupled, and when a language version is not explicitly specified, it will default to the highest language version supported by the target runtime.
  • .NET 9 and C# 12 are now supported.
  • The CLI tool now has a --useRelativeLinePragmas argument.
  • The DOTNET_ROOT environment variable is now respected.
  • The new CreateTempSubdirectory method from .NET 7 is now used for temp directory creation, massively reducing the chance of temp directory name collisions. This has also been backported to older runtimes

Packages

The following packages are published for this release on NuGet.org:

Per the warning in 2.3.1, the dotnet-t4-project-tool package has been discontinued. The dotnet-t4 package is a drop-in replacement and can be installed as a local tool.

Merged PRs

  • Merge release/v2.3.0 back into main by @mhutch in #141
  • Add MSBuild targets by @mhutch in #110
  • Backport 2.3.1 to main by @mhutch in #147
  • Merge release/v2.3.0 back to main by @mhutch in #146
  • Remove unsupported TFMs by @mhutch in #159
  • Update tests for current environments by @mhutch in #151
  • Reduce risk of collision in temp directory creation by @mhutch in #160
  • Exposes the generator's UseRelativeLinePragmas option in the CLI tool. by @mwadams in #154
  • Fix StackOverflowException in ParsedTemplate.cs by @MaceWindu in #148
  • Clean up build targets package by @mhutch in #161
  • Use async main instead of sync-over-async by @mhutch in #162
  • Fix some packaging issues by @mhutch in #163
  • Fix more packaging issues by @mhutch in #164
  • Take TFM into account in build tasks by @mhutch in #165
  • Better defaults and handling for LangVersion by @mhutch in #167
  • Don't use AppDomain codepath for CurrentDomain by @mhutch in #171
  • Fix assembly load priorities when using AssemblyLoadContext by @mhutch in #173
  • Add host option to disable AssemblyLoadContext by @mhutch in #172
  • Targets improvements by @mhutch in #175
  • Use None/Include to ensure items are included in generated nupkg files. by @abbottdev in #177
  • Fix race in incremental build tests by @mhutch in #178
  • Respect DOTNET_ROOT env var by @mhutch in #179
  • Don't try to pass langversion 13 just yet by @mhutch in #181

New Contributors

Full Changelog: v2.3.1...v3.0.0