Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / December 2004

Tip: Looking for answers? Try searching our database.

Trouble invoking method in a dynamically loaded assembly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PMVT - 01 Dec 2004 22:43 GMT
I am writing an addin for Word 2000 in C#.  The addin just calls a static
method called Launch from a dotfuscated library, which contains all the
actual content. The Launch method is the only exposed (non-obfuscated) method
in the library.

I can dynamically load the assebly and get the MethodInfo for the Launch
method.  When I try to invoke it, however, a FileNotFoundException is thrown,
claiming that Interop.Word.dll could not be found.  This file is included in
the deployment package and is in the ssame directory as the addin DLL.  The
exception text shows that the CLR is looking in C:\Program Files\Microsoft
Office\Office\.

How can I direct the CLR to look in the right directory?  I have seen some
suggestions to create an AppDomain, but I don't really understand how this
works, and, off hand, it seems like over kill.

TIA
"Peter Huang" [MSFT] - 03 Dec 2004 02:14 GMT
Hi

I think since the the addin is loaded in the winword.exe, so the appbase
where CLR checked as the base directory where the winword.exe located.
So far  to make a simple test, you may try to copy the interop.word.dll to
the C:\Program Files\Microsoft Office\Office\ to see if that works.

If yes, I think we may try to build a office 2000 PIA which will be put
into GAC, so that the CLR will check the GAC anyway.

Here is link about office 2000 PIA generator.
http://groups.google.com/groups?hl=zh-CN&lr=&c2coff=1&threadm=M54apYQ0EHA.30
28%40cpmsftngxa10.phx.gbl&rnum=3&prev=/groups%3Fq%3D%2522peter%2520huang%252
2%2520office%25202000%2520PIA%26hl%3Dzh-CN%26lr%3D%26c2coff%3D1%26sa%3DN%26t
ab%3Dwg

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.