- [Codegen] Fixed an issue where line mappings were missing between Razor templates and generated files.
- Fixed package bundling issues which sometimes caused errors when resolving
Microsoft.CodeAnalysis.CSharp
.
- [Compiler] Added an overload to
Razor.Compile(...)
that allows specifying a list of assembly references to load. When using this overload, automatic assembly resolution present in other overloads will be disabled. (Thanks to @Stuart Lang)
- Added cancellation support to
RenderAsync(...)
method in both runtime and build-time compilation workflows. An instance ofCancellationToken
passed toRenderAsync(...)
is exposed inside of the template via theCancellationToken
property. You can use this token to cancel operations started within the template.
- [Codegen] Fixed an issue where generated files included a checksum directive that referenced a non-existing file.
- [Codegen] Hint names for generated files now end with
.g.cs
to follow the generally accepted conventions. By extension, this also fixes an issue which caused Coverlet to fail when instrumenting assemblies that used MiniRazor's compile-time generation. - [Codegen] Added
Microsoft.CodeAnalysis.CSharp
assembly file inside the package for better compatibility. - [Compiler] Fixed an issue where calling
Razor.Compile(...)
threw an exception when it failed to load a transitive assembly. - [Compiler] Changed
accessModifier
parameter inRazor.Transpile(...)
to nullable and optional. - Added
netcoreapp3.0
andnetstandard2.1
targets to MiniRazor meta package to match the targets available for MiniRazor.Compiler. - Added readme file to the package.
- [CodeGen] Fixed an issue where MiniRazor.CodeGen was incorrectly installed as development dependency by default.
- [CodeGen] Fixed an issue where the source generator didn't work because the package was missing some of the embedded binaries.
- Split MiniRazor package into additional specialized packages: (Thanks @Kevin Gliewe)
- MiniRazor.Runtime, which contains runtime types required by MiniRazor templates. You shouldn't ever need to reference this package yourself.
- MiniRazor.Compiler, which contains methods to compile Razor templates into IL. You can reference this package if you're only using MiniRazor for runtime template compilation.
- MiniRazor.CodeGen, which contains source generator that converts Razor templates into C# classes. You can reference this package if you're only using MiniRazor for build-time template compilation.
- MiniRazor, which is now just a meta package that links both MiniRazor.Compiler and MiniRazor.CodeGen. You can reference this package if you're using MiniRazor for both runtime and build-time template compilation.
- [CodeGen] Added
AccessModifier
property that can be specified onAdditionalFiles
to configure access modifier used for generated code. Default access modifier isinternal
. (Thanks @TheJayMann) - [CodeGen] Fixed an issue where adding two templates with same name but different namespaces resulted in a compilation error. (Thanks @TheJayMann)
- Fixed more issues in generated code.
- Added
#nullable disable
to generated code.
- Fixed a build error that occurred when attempting to use MiniRazor's source generator.
- Reworked the library. Please refer to the readme for updated usage instructions.
- Implemented support for build time template compilation via C# source generators.
- Added assembly unloading.
- Fixed an issue where the parent assembly was not added to the template assembly metadata references.