adoconnection / RazorEngineCore

.NET6 Razor Template Engine
MIT License
585 stars 88 forks source link

handle assembly loading for full framework #30

Closed krmr closed 4 years ago

krmr commented 4 years ago

When using the package in a .NET Framework 4.7.2 application it throws an FileNotFoundException on some assemblies from GAC e.g. Microsoft.CSharp and netstandard. This happens for example when using Program.cs from ExampleApp in a .NET Framework console app.

This seems to be because in .NET Framework Assembly.Load does not work from GAC with only the name but bascially requires a full name. The code in the Pull Request handles this by changing the loading of some assemblies when detecting full framework. For some assemblies it can be done by using types to load them. But unfortunately it has to sue specifing specific versions for some assemblies. At least that was the only way I go this to work.

adoconnection commented 4 years ago

Hi, may I ask you to add full framework test project, as I have troubles running it in full framework console app. 'Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.6.0.0

farlee2121 commented 4 years ago

Hello. When do you plan to release a new package version with this update?

adoconnection commented 4 years ago

@farlee2121 done! https://www.nuget.org/packages/RazorEngineCore