Closed General-Fault closed 2 hours ago
Admittedly, my "steps to reproduce" are not ideal. I will see if I can put together a simple project that replicates this behavior.
ILMerge utility is not supported and I don't recall any plans to support it. Considering that it has been deprecated, I'm closing this one as "won't do"
Describe the bug RazorLight cannot be used in an application that has been merged into a single assembly using ILMerge. ILMerge combines all referenced assemblies into one. This has the side-effect of changing the assembly name for all types that have been merged. So, when the
OverrideRuntimeNodeWriterTemplateTypeNamePhase
attempts to locate theMicrosoft.AspNetCore.Razor.Language.DefaultRazorCSharpLoweringPhase type
in theRegister
method, it fails because theAssemblyQualifiedName
for that type no longer contains "Microsoft.AspNet.Core.Razor.Language" as the assembly name. The result is thatOverrideRuntimeNodeWriterTemplateTypeNamePhase.Register
throws a RazorLightException with the error "SetTemplateTypePhase cannot be registered as DefaultRazorCSharpLoweringPhase could not be located".See also #322
To Reproduce Create a console application for .Net Framework 4.8 using RazorLight. ~I used the RazorLightSandbox and updated the async using statements in Main() to comply with C#7.3.~ Install the ILMerge.MSBuild.Task package (see https://github.com/emerbrito/ILMerge-MSBuild-Task/wiki) Compile the project. There should be an ILMerge directory in the output.
Run the generated executable.
You should see the error
Expected behavior The library should be usable in an assembly that has been merged with ILMerge.
Information (please complete the following information):
Additional context The application that this applies to is a portable tool used by our development team to create API documentation. The tool must be a single executable with all dependencies "wrapped in". Unfortunately, other dependencies of this tool are still targeting the .Net Framework v4.8.