toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.51k stars 260 forks source link

Strong Name RazorLight #343

Closed geisi93 closed 4 years ago

geisi93 commented 4 years ago

Would it be possible to Strong Name Sign the RazorLight.dll (2.0.0-beta7)? This would enable Strong Named Projects to use RazorLight without the need of using any hacky Strong Namer.

Thanks in Advance.

jzabroski commented 4 years ago

Can you explain why you think a strong naming tool is hacky if it happens during the build vs. prepackaged in nuget? It seems much more elegant to address strong naming as part of the build process. Are there user stories where this causes issues?

On my side, the basic problem with strong naming anything is its a major version upgrade implication due to breaking the ABI. It then also makes including any third party dependencies in the future harder, and reverting the decision to strong name is harder, as well.

jzabroski commented 4 years ago

@geisi93 I'll close this request. Please re-open when you have time to answer my questions. Thanks.

doxxx commented 1 year ago

The issue with StrongNamer is that now I also have to use it in every application that uses my (strong-named) library that depends on RazorLight, otherwise I get runtime errors when compiling templates:

The type 'TemplatePage<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'RazorLight, Version=2.3.0.0, Culture=neutral, PublicKeyToken=e33b67d3bb5581e4'.

Microsoft's guidance on this issue: https://github.com/dotnet/runtime/blob/main/docs/project/strong-name-signing.md

Because of the viral nature of strong-naming, it is recommended that publicly published .NET libraries are strong-named. Not strong-naming a .NET library excludes anyone who does need to strong-name their application or library from using it.

doxxx commented 1 year ago

That said, perhaps I should be disabling strong-naming for my assemblies since apparently it's no longer really recommended for .NET 5+ applications.