We are using Costura.Fody to pack all our binaries into a single DLL. It has a VS solution with a single project and we pack all its dependencies to it. As long as this project was single within the solution, it was working. But recently we moved some features into another project. Since then, the library fails to load with System.Reflection.Assembly.LoadFrom
, throwing the following error:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
=== LOADER EXCEPTIONS ===
System.IO.FileNotFoundException:
---
System.IO.FileNotFoundException: Could not load file or assembly 'OurCompany.OurProject.TheLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'OurCompany.OurProject.TheLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
=== Pre-bind state information ===
LOG: DisplayName = OurCompany.OurProject.TheLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Work/Test/LibraryExplorer.Cli/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : OurCompany.OurProject, Version=1.0.62.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Work\Test\LibraryExplorer.Cli\bin\Debug\LibraryExplorer.Cli.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Work/Test/LibraryExplorer.Cli/bin/Debug/OurCompany.OurProject.TheLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Work/Test/LibraryExplorer.Cli/bin/Debug/OurCompany.OurProject.TheLibrary/OurCompany.OurProject.TheLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Work/Test/LibraryExplorer.Cli/bin/Debug/OurCompany.OurProject.TheLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Work/Test/LibraryExplorer.Cli/bin/Debug/OurCompany.OurProject.TheLibrary/OurCompany.OurProject.TheLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/dominik.janata/AppData/Local/Temp/ProjectClock/OurCompany.OurProject.TheLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/dominik.janata/AppData/Local/Temp/ProjectClock/OurCompany.OurProject.TheLibrary/OurCompany.OurProject.TheLibrary.DLL.
LOG: Attempting download of new URL file:///C:/Users/dominik.janata/AppData/Local/Temp/ProjectClock/OurCompany.OurProject.TheLibrary.EXE.
LOG: Attempting download of new URL file:///C:/Users/dominik.janata/AppData/Local/Temp/ProjectClock/OurCompany.OurProject.TheLibrary/OurCompany.OurProject.TheLibrary.EXE.
To address an obvious suggestion, OurCompany.OurProject.TheLibrary.DLL
is packed among the resources of OurCompany.OurProject.DLL