Why does a library generated by Costura.Fody require DLL it has included inside? RRS feed

  • Question

  • 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.
    System.IO.FileNotFoundException: Could not load file or assembly 'OurCompany.OurProject.TheLibrary, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    File name: 'OurCompany.OurProject.TheLibrary, Version=, Culture=neutral, PublicKeyToken=null'
    === Pre-bind state information ===
    LOG: DisplayName = OurCompany.OurProject.TheLibrary, Version=, Culture=neutral, PublicKeyToken=null
    LOG: Appbase = file:///C:/Work/Test/LibraryExplorer.Cli/bin/Debug/
    LOG: Initial PrivatePath = NULL
    Calling assembly : OurCompany.OurProject, Version=, 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

    Friday, January 10, 2020 4:07 PM

All replies

  • Hi Dominik Janata,

    Thank you for posting here.

    According to your description, your issue is more related to Costura.Fody. Therefore, it will be more appropriate to ask your question in Costura.Fody Forum for better help. 

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 13, 2020 9:15 AM