adoconnection / RazorEngineCore

.NET6 Razor Template Engine
MIT License
565 stars 84 forks source link

Fix .NET8 for AOT / Single Executable #142

Open DashNY opened 1 month ago

DashNY commented 1 month ago

This PR updates the references to Microsoft.AspNetCore.Razor.Language and Microsoft.CodeAnalysis.CSharp to their latest versions in order to fix the Ahead-of-Time (AOT) compilation of the assembly in .NET 8.

AOT allows publishing of your entire application as a single executable, with all assemblies pre-compiled natively, resulting in faster startup time. The older versions of those libraries are not compatible with AOT and cause errors when publishing for AOT.

The upgrade does not appear to cause any issues, and all tests still pass. I've added ExampleAppNET8 project, and AOT functionality can be tested by right-clicking it and selecting Publish.

DashNY commented 1 month ago

hey @adoconnection just checking if you had a chance to review. Without this change, we're force to manually pin those newer versions in our .csproj files to fix the AOT publishing. It would be great to avoid that. Thanks.

adoconnection commented 1 month ago

Hi, sorry, was a bit busy. Thanks for PR looks good to me! Very handy update