Repository navigation
RazorEngine.NetFramework 5.0.0-rc.1
Pre-release
Pre-release
·
20 commits
to master
since this release
Release candidate of 5.0.0: install it with prereleases enabled (Install-Package RazorEngine.NetFramework -Prerelease) and report problems in the issues before the final 5.0.0.
5.0.0 splits RazorEngine into two packages (#22): the core package no longer depends on Roslyn, and Roslyn becomes opt-in. Read Upgrading to 5.0 before updating.
| Package | Contents | Dependencies |
|---|---|---|
RazorEngine.NetFramework |
Razor integration, templating, caching, CodeDom compiler service | Microsoft.AspNet.Razor 3.3.0 |
RazorEngine.NetFramework.Roslyn (new) |
RoslynCompilerServiceFactory, CSharpRoslynCompilerService, RoslynCompilerServiceBase, the metadata reference cache, LanguageVersion |
RazorEngine.NetFramework, Microsoft.CodeAnalysis.CSharp 5.6.0 |
Breaking changes
- (BREAKING) CodeDom is the default compiler again.
DefaultCompilerServiceFactory(the defaultCompilerServiceFactory) compiles templates with CodeDom (thecsc.exeof .NET Framework, C# 5), as before 4.1. Templates that use C# 6 or newer syntax fail to compile unless you install the Roslyn package and setRoslynCompilerServiceFactory. Installing the Roslyn package alone does not change the compiler; it is an explicit opt-in. - (BREAKING) Roslyn moved to
RazorEngine.NetFramework.Roslyn(assemblyRazorEngine.NetFramework.Roslyn.dll, same signing key). The namespaces stay (RazorEngine.Roslyn,RazorEngine.Roslyn.CSharp); only the assembly part of assembly-qualified names changes, for examplecompilerServiceFactoryType="RazorEngine.Roslyn.RoslynCompilerServiceFactory, RazorEngine.NetFramework.Roslyn". - (BREAKING)
DefaultCompilerServiceFactory.LanguageVersionremoved. UseRoslynCompilerServiceFactory.LanguageVersion.RoslynCompilerServiceFactoryno longer derives fromDefaultCompilerServiceFactory; it implementsICompilerServiceFactorydirectly. - (BREAKING) Templates compiled with CodeDom are C# 5 again: code that relied on
fieldas the C# 14 backing field changes meaning back (see the 4.1.0 notes). - (BREAKING) Removed the types that are obsolete since 4.3.0:
CompilerServiceBuilder(RazorEngine never used it; setCompilerServiceFactoryon theTemplateServiceConfiguration) andHtmlTemplateBase<T>(useTemplateBase<T>). - (BREAKING) Removed the members that are obsolete since 3.x:
TemplateBase.RazorEngineandITemplate.RazorEngine: useRazor. Templates can now use theRazorEnginenamespace without it being hidden by this property.DynamicViewBag.AddDictionaryValues,AddDictionaryValuesExandAddListValues: useAddDictionaryorAddValue.
- (BREAKING) As announced in 4.3.0, the implementation details
IsolatedRazorEngineService.SanboxHelper,CrossAppDomainCleanUp.CleanupHelperandCleanupHelper.SubscribeHelperare internal. They were hidden from IntelliSense since 4.3.0 and only meant for RazorEngine's own AppDomain communication.
New
- (NEW) The Roslyn package depends on exactly the same version of the core package (
[5.0.0]), because both are released together and the Roslyn compiler service builds on the core's compiler base classes. - (NEW) Modern C# with CodeDom, without Roslyn in your process.
CodeDomCompilerServiceFactory(andDefaultCompilerServiceFactory, which now derives from it) hasCodeDomProviderFactoryto compile with anotherCodeDomProvider, for example Microsoft.CodeDom.Providers.DotNetCompilerPlatform, andCompilerOptionsfor additional compiler switches such as/langversion:7.3(with a provider that supports it).CSharpDirectCompilerServicehas a constructor that takes theCodeDomProvider; the compiler service disposes it.DirectCompilerServiceBasehasCompilerOptionsand aConfigureCompilerParametershook, and a factory derived fromCodeDomCompilerServiceFactorycan create its own service by overridingCreateCSharpCompilerService. See Roslyn. - (PACKAGING) The core package depends only on Microsoft.AspNet.Razor 3.3.0, so applications without the Roslyn package need no binding redirects for Roslyn's System.* dependencies, and ASP.NET no longer loads Roslyn from
binat startup. - (BUILD) Both packages are built, tested and released together with the same version. Package validation of the core package against 4.3.0 lists the intended breaking changes in
CompatibilitySuppressions.xml. - (BUILD) The core tests no longer use Roslyn, which also shows that the core works without it. The tests that compare CodeDom and Roslyn moved to the Roslyn tests.
- (FIX) Null arguments are rejected right away with an
ArgumentNullException, for example inFluentTemplateServiceConfiguration,ActivateUsingandTypeLoader. The checks were Code Contracts calls (Contract.Requires), which the compiler removes unlessCONTRACTS_FULLis defined, so they never ran and anullfailed later with a less clear error. - (BUILD) Removed leftovers of tools the build does not use: the FxCop suppressions (
SuppressMessage, includingGlobalSuppressions.cs) and the Code Contracts[Pure]attributes. They had no effect.
NuGet: https://www.nuget.org/packages/RazorEngine.NetFramework/5.0.0-rc.1
NuGet (Roslyn): https://www.nuget.org/packages/RazorEngine.NetFramework.Roslyn/5.0.0-rc.1