RazorEngineCore icon indicating copy to clipboard operation
RazorEngineCore copied to clipboard

Fix .NET8 for AOT / Single Executable

Open DashNY opened this issue 1 year ago • 3 comments

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 avatar Jun 11 '24 02:06 DashNY

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.

DashNY avatar Jun 14 '24 02:06 DashNY

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

adoconnection avatar Jun 17 '24 17:06 adoconnection

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

Hi, this might be useful for us as well. Could this be merged.

lpottimuthi avatar Dec 24 '24 14:12 lpottimuthi