0

I am getting an error back from a DLL saying it cannot create an instance of one of classes in my solution because it cannot find the assembly file.

If I am debugging a solution, do I need to put a copy of certain assembly files in other locations?

EDIT:

In my compiled solution all the DLLs (including the proprietary ones) all go in the app directory and it works fine. But I am trying to work out where the files should do in order to debug the solution.

Craig Johnston
  • 5,303
  • 8
  • 27
  • 30

4 Answers4

1

Put the assembly in question in 1) the same directory, or 2) in the GAC, or 3) use AssemblyBinding to define the specific path that the .NET framework.

MSDN link: using AssemblyBinding to define the referenced assembly path

code4life
  • 15,655
  • 7
  • 50
  • 82
0

I think you have forgotten to add reference of the assembly to the project.

Add the reference, and try again.

Read more here -> http://msdn.microsoft.com/en-us/library/7314433t%28VS.80%29.aspx

Nayan
  • 3,092
  • 25
  • 34
0

If they are in your references list, try right-clicking the problem reference in the solution explorer and selecting "properties". There is one property called copy local. Make sure that is true. Then when you build, a copy of that dll will be in your bin folder.

Dave Archer
  • 3,022
  • 20
  • 23
0

You can add an event handler to AssemblyResolve to find out which library it tries to load. Some sample code and ideas can be get from this question.

Update
To find out, what is the best place for your project you should take a look into How the Runtime Locates Assemblies guide. Also to get a live view about where the framework searches for your needed dll you can use ProcessMonitor to see where it tries to catch it.

Community
  • 1
  • 1
Oliver
  • 43,366
  • 8
  • 94
  • 151
  • 1
    I know which assembly it is trying to load because the Exception is telling me which one. I just don't know where to put the assembly. Should it go in the directory of the calling DLL? – Craig Johnston Apr 27 '10 at 10:54
  • @Craig: Yes, it should go in the same directory as the calling DLL, or the GAC. Otherwise it won't find it. See code4life's answer – NotMe Apr 27 '10 at 14:02