开发者

FileNotFoundException when using an Interop assembly (even if the file exists)

I am trying to automate actions against some in house ActiveX browser control.

I added a reference to the COM type in my C# code, which automagically generates the Interop.AssemblyName.dll

2 Weeks ago when i tested this, it worked like a charm, however trying the same code now fails with a FileNotFoundExc开发者_JAVA百科eption when trying to get a reference to some type found in the interop assembly.

How can i trace back exactly what is the source of error? the Interop file exists right next to my test application's exe.

What else should i be looking for?

Is there any good tutorial on interoperability and problems of this kind?


It's looking in the wrong location...a location other than the one you expect. Simplest way to track this down is to look at the detail of the Exception, but if that's unrevealing I would use Process Monitor from Sysinternals to track down exactly what's going on.


I had this problem with a WMI class I created that hooked into a COM object to pull back information. WMI wrote to the event log that the Interop file for the COM object could not be found.

I resolved it just as Chris B. Behrens said: capture all disk IO while generating the exception and see where it is looking for, and failing to find, the interop file.

...And yes, my interop file was alongside my main application the entire time, however that directory was not one of the locations searched when the system tried to find it. Bizarre.

I copied my interop file to C:\Windows\System32\wbem and it magically started working (Windows XP x86).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜