开发者

C#: cannot find assembly file

开发者 https://www.devze.com 2022-12-28 02:18 出处:网络
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 fil开发者_如何学JAVAe.

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 fil开发者_如何学JAVAe.

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.


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


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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号