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 / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

assembly search path

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DeveloperX - 31 Aug 2007 15:45 GMT
I've a shared add in written in C#. It works on the dev machine fine
with VS2003 installed, but not on a machine without VS.
We've been doing lots of research, and my current concern (discovered
using filemon) is that it looks in the app base directory. In this
case the app base directory is the home of Excel.exe. I can load my
application specific portion of the add into a seperate appdomain and
set the dll path from there, but then I have to marshal the Excel
application object across, and I have yet to figure out (try) that. It
seems unnecessary as it all works a treat on the dev machine. Both dev
and test machine have admin rights.

So question one: Is there a way to encourage my add in to look in its
directory, not the app's directory for the DLL's?
question two: what is different between a machine with VS installed
and one without (barring the obvious)?

Cheers
Stanimir Stoyanov - 31 Aug 2007 15:54 GMT
> So question one: Is there a way to encourage my add in to look in its
> directory, not the app's directory for the DLL's?

You can make use of the AppDomain.AssemblyResolve [1] event in your default
AppDomain to check whether or not the current request is for loading your
assemblies, and if so, call Assembly.LoadFile [2] with the full path
instead.

> question two: what is different between a machine with VS installed
> and one without (barring the obvious)?
Virtually none. However, you may have several additional assembly
directories appended to the PATH environment variable which are used as
search paths.

[1]
http://msdn2.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx
[2]
http://msdn2.microsoft.com/en-us/library/system.reflection.assembly.loadfile.aspx

Best Regards,
Stanimir Stoyanov
www.stoyanoff.info | www.aeroxp.org
DeveloperX - 31 Aug 2007 16:47 GMT
> > So question one: Is there a way to encourage my add in to look in its
> > directory, not the app's directory for the DLL's?
[quoted text clipped - 16 lines]
> Best Regards,
> Stanimir Stoyanovwww.stoyanoff.info|www.aeroxp.org

Cheers Stanimir, that should do the trick nicely!

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.