473,387 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

Aug 31 '07 #1
2 2520
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/lib...lyresolve.aspx
[2]
http://msdn2.microsoft.com/en-us/lib....loadfile.aspx

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

Aug 31 '07 #2
On 31 Aug, 15:54, "Stanimir Stoyanov" <ad...@stoyanoff.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.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.assemblyres...
[2]http://msdn2.microsoft.com/en-us/library/system.reflection.assembly.l...

Best Regards,
Stanimir Stoyanovwww.stoyanoff.info|www.aeroxp.org
Cheers Stanimir, that should do the trick nicely!

Aug 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Yang Liu | last post by:
Hi all, I have a .net windows application xx.exe, which reference a private assembly yy.dll, the property "local copy" of the yy.dll reference is automatically set to true, so the yy.dll will be...
4
by: Mark | last post by:
I wan't to be able to deserialize a class from an assembly that is not in the application domain. To do that I must have the Type from the Assembly. How do you get a Type from an assembly that is...
5
by: Julie | last post by:
I'm currently working in a mixed mode project where the exe is C#, there is a managed C++ (DLL) assembly, that in part, includes some calls into a native (unmamanged) DLL. I can build/link/run...
0
by: David | last post by:
I have been trying to get a simple mfc dll I wrote to add to numbers call a C# assembly. Here is a sample of my C++ code in my cpp file. extern "C" _declspec(dllexport) int Calc(int no1,int no2)...
1
by: Ryan Moore | last post by:
I need to add an additional directory to search for assemblies other than the "bin" directory.... how do I do this in the web.config file?
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
2
by: Luis Arvayo | last post by:
I am compiling and executing c# code at runtime and I need to define in CompilerParameters.ReferencedAssemblies one of my own assemblies together with the standard System.dll u others. Example:...
3
by: Kopiad | last post by:
I have two assemblys A and B in folder 1. Assembly A references assembly B. In another folder 2, I have a program C that do a Assmebly.LoadFile(<absolute path to assembly A) and creates an...
2
by: Jeff | last post by:
Hi I'm trying to achieve a scenario where I have c# files that are compiled dynamically, the assemblies are then loaded in a different AppDomain, I call a simple method from the object, and then...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.