mercredi 8 janvier 2020

Assembly.Load + Dependencies

I am facing an issue when loading DLLs and their references. The scenario is this:

I have a C# library project (let's call it "A") which references another C# library project (let's call it "B"). Both the Dlls of these projects are stored on Azure Blob storage but this is irrelevant in reality.

As part of my project I am using XslCompiledTransform.Transform. After loading dll A using Assembly.Load, I then load dll B using again Assembly.Load.

The issue is that after executing the Transform method I keep getting an error that dll B cannot be found, even though it is present when I call AppDomain.CurrentDomain.GetAssemblies();

As a note, if I remove the dependency of B from A everything works, so we can ensure that the Transform, using just dll A, is working.

FileNotFoundException: Could not load file or assembly 'xxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

One more thing, if I add dll B to the projects Bin folder then it works, but of course, I cannot do this, I just did this to prove that it works.





Aucun commentaire:

Enregistrer un commentaire