System.IO.FileNotFoundException: Could not load file or assembly

27,432

Solution 1

Go to your output directory and walk though all your DLL's using http://www.dependencywalker.com. Find the missing dll, use the exception to give you a good starting position.

I don't believe what you want to do is possible though. If your DLL has dependencies on other DLL's, then your DLL needs access the other DLL's. You can't simply build the other DLL's into your DLL.

Solution 2

Copy local means that it will be copied to the bin folder of the current project which in the application files case would then copy it to the bin folder of the application files which is not what you want.

Try changing the output path (Right click properties on project -> Build) of your application files to the bin path of your exe project

Share:
27,432
devman
Author by

devman

Updated on April 30, 2020

Comments

  • devman
    devman about 4 years

    I have a WPF application that has 3 projects in the solution. I have the main menu, which is the actual EXE, a reporting DLL and the application files DLL which both are a WPF Class Library. I'm getting the System.IO error when I'm trying to use a 3rd party reporting tool from in the application files DLL. I have the 3rd party DLLs referenced and are set to copy local in my application DLL. Everything works fine if i reference the 3rd party reporting tool in the EXE project but I don't want to do that. I want my DLL to be stand alone so someone else can reference my DLL without having to add anything but my DLL. Anyone have any idea of what i might need to do to fix this? Thanks

  • devman
    devman almost 13 years
    that was what i was wondering too, if its even possible. To package a dll inside a dll so the exe using the parent dll doesn't know whats in the dll...
  • Rich
    Rich almost 13 years
    Actually, you can combine multiple .NET assemblies into a single assembly using ILMerge.