assembly search path

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DeveloperX

    #1

    assembly search path

    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

    #2
    Re: assembly search path

    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.Assem blyResolve [1] event in your default
    AppDomain to check whether or not the current request is for loading your
    assemblies, and if so, call Assembly.LoadFi le [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/lib...lyresolve.aspx
    [2]
    http://msdn2.microsoft.com/en-us/lib....loadfile.aspx

    Best Regards,
    Stanimir Stoyanov
    www.stoyanoff.info | www.aeroxp.org

    Comment

    • DeveloperX

      #3
      Re: assembly search path

      On 31 Aug, 15:54, "Stanimir Stoyanov" <ad...@stoyanof f.infowrote:
      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.Assem blyResolve [1] event in your default
      AppDomain to check whether or not the current request is for loading your
      assemblies, and if so, call Assembly.LoadFi le [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.appdomai n.assemblyres.. .
      [2]http://msdn2.microsoft .com/en-us/library/system.reflecti on.assembly.l.. .
      >
      Best Regards,
      Stanimir Stoyanovwww.sto yanoff.info|www.aeroxp.org
      Cheers Stanimir, that should do the trick nicely!

      Comment

      Working...