/string-syntax-polyfill

A source code package which makes StringSyntaxAttribute available to target frameworks older than .NET 7.

Primary LanguageC#MIT LicenseMIT

String Syntax Polyfill

NuGet Package GitHub Release

Makes StringSyntaxAttribute available to target frameworks older than .NET 7. This enables IDE features such as syntax highlighting and code completion within strings, and Visual Studio currently supports DateTimeFormat, Json, and Regex as of version 17.2.

Table of Contents

Compatibility

Including projects must be compatible with .NET Standard 1.0 and use C# 8 or later. This means projects targeting the following should work:

  • .NET/.NET Core 1.0 or greater
  • .NET Framework 4.5 or greater
  • .NET Standard 1.0 or greater

Alternatives

You might instead consider PolySharp which uses a source generator to provide polyfills for [StringSyntax] among other types in order to enable various new C# language features on older runtimes.

Building the NuGet Package

dotnet tool install -g dotnet-script
  • Within the src directory, run the build script with the new build number as an argument, e.g.; 1.2.3.
dotnet script build.csx -- 1.2.3
  • Review the output to ensure that the build succeeded.