RickStrahl / Westwind.RazorHosting

Hosting the Razor Runtime outside of ASP.NET/MVC for use in non-Web .NET applications.
144 stars 32 forks source link

Skip assemblies already loaded #1

Closed mauroservienti closed 7 years ago

mauroservienti commented 11 years ago

In some cases when hosting the RazorEngine in a Windows Service we get the following exception at template rendering time:

"An assembly with the same simple name '' has already been imported"

As far as I have understood is due to to the fact that not all the "AddAssembly" methods checks if assemblies are already in the ReferencedAssemblies collection.

RickStrahl commented 11 years ago

Razor internally manages the assembly adds - the code in the library doesn't actually track duplicates. In my tests adding the same assembly twice seems to work just fine.

This library just passes on the assemblies. I think the error might occur if you try to load the same assembly from different locations?