NetTemplate 3.1.0

dotnet add package NetTemplate --version 3.1.0
                    
NuGet\Install-Package NetTemplate -Version 3.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetTemplate" Version="3.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetTemplate" Version="3.1.0" />
                    
Directory.Packages.props
<PackageReference Include="NetTemplate" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NetTemplate --version 3.1.0
                    
#r "nuget: NetTemplate, 3.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NetTemplate@3.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NetTemplate&version=3.1.0
                    
Install as a Cake Addin
#tool nuget:?package=NetTemplate&version=3.1.0
                    
Install as a Cake Tool

NetTemplate

Nuget

This is a fork of StringTemplate 4 for .NET to modernize it. The goal of this project is to be a superset of StringTemplate 4. That is, any template of StringTemplate 4 can be using with this library unmodified with additional features available.

Usage

The 1.X version can be drop-in replacement for StringTemplate4. Just rename namespace from Antlr4.StringTemplate to NetTemplate. Every next major version will have some small breaking changes on the code so you can slowly upgraded. The template itself will never have a breaking change (unless StringTemplate 4 introduced it), only the code that using this library.

Additional features

Expression options

The following is a list of the new expression options in additional to StringTemplate 4 expression options:

  • culture: specify the name of the culture to override the one that was specified in Template.Render() (e.g. <foo; culture="th-TH">). It can be any value that is acceptable by CultureInfo.GetCultureInfo(), even an empty string.

Breaking changes

2.0 to 3.0

  • All constructors of NetTemplate.Interpreter become internal.
  • Any exception from the template will propagation to the call site instead of raising an INTERNAL_ERROR.

1.0 to 2.0

  • culture parameter on IAttributeRenderer.ToString() will be able to override by the user.
  • IFormattable object will be honored during rendering.
  • NetTemplate.Interpreter become a sealed class.
  • AssemblyInfo has been removed.

Development

Prerequisites

  • .NET 6 SDK

Build

dotnet build src/NetTemplate.sln

Run tests

dotnet test src/NetTemplate.sln

License

BSD 3-Clause

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.1.0 1,101 4/19/2026
3.0.0 546 4/30/2023
2.0.0 352 4/15/2023
1.0.0 1,540 3/13/2022