473,241 Members | 1,504 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,241 software developers and data experts.

about locating assemblies


It seems like none of the old posts get any follow up after a few messages,
whether or not something constructive comes out of them, so I'm left with no
choice but to repost an earlier question I asked. Below I've copy-pasted the
log of the last post. It's an interesting problem, and it might well be worth
reading if you are willing to be patient.

As always, I would appreciate your comments immensely




Alright, I think I have a better perception of assemblies and environment
variables now. The question I had initially posted was pertaining setting of
environment variables using the VSI installer. This was presumed essential
for specifying the paths to certain dlls. Subsequently, the idea was dropped,
and the appication configuration file approach was adopted. However, the
application is not able to resolve the assembly location, and raises a
System.DllNotFoundError exception. I would appreciate if any one of you can
read the following, and give some constructive feedback:

Brief background:
The application uses dlls made in c++/c, which have been wrapped for using
in C#. Initially, we had set the environment variables manually on our
machines to point to the location of these dlls. As expected, it worked
without any problem, though in retrospect, this approach could perhaps have
been avoided.

app.config file modified:
Configuration files seem to be a better way for locating assemblies. Since
the dlls in question were not strongly typed, I modified the <probing> tag of
the app.config file instead of the <codeBase> tag. I assumed the application
base folder to be the one where my application executable is located, and
subsequently had my installer place all the folders containing the different
dlls into this directory, so that they may be accessed as subfolders by the
probing tag.

All seemed well so far. One of those folders had the dll in question.
Installing and running the application however, made the application raise an
exception when this dlls was needed, a System.DllNotFoundError.

Possible problem?:

Thanks to a software one of my colleagues gave me, I was able to monitor the
files that were being accessed by the different processes on my computer. On
studying the log, it appeared that my application was searching in all paths,
for the one specified in the probing tag's privatePath attribute. It is
correctly defined; I have checked up the syntax and examples, so that's not
the reason for the problem. It seems like the application is not able to pick
up this information from the application configuration file, so it does not
look into the concerned subfolder and therefore, raises the given exception.

As a simplistic test, I physically copied this dll from the subfolder into
the application folder, and yes, this time the exception was not raised.

I'm not sure where the problem is now. Could it be the config file? Or since
this wrapped dll needs to be invoked by another one, somehow that's not
working (though it does if placed in the application folder).

Any help would be great


It would help if you could post parts of the config file that are
relevant to your problem. Kinda hard to tell what the problem could be
with your config file without having a look at it ;)

- NuTcAsE

Sure I could do that, though I think it might not help.... Here's the block I
used in the config file:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="DllFolder" />

You may assume this to be a subfolder in the application base folder (where
the applciation executable is).

Now I suspect the problem is not because of the config file. It seems to me
that the config file is only read when the application is loaded. If later
the application needs to invoke a dll, the app.config file will not be read
again, and therefore, the application will have no way of accessing the dll.

And since all the dlls I'm using are weakly named, I don't think I can use
any other feature of the config files, either application based or machine

As things stand currently, it seems like I have the following two options:

a) To have the user set the environment variables (Path) or do that from my
installer program, an approach I'm not inclined to taking and I'm sure none
of you will encourage it.

b) The second solution would be to dump all the required dlls in the
application folder: This solution would be less elegant and not as memory
efficient, but atleast it would work...

I'm wondering if there is any other way to permanently set the location for
the application to search the dlls in. Do you have any suggestions that might


Jan 19 '06 #1
1 1663
"Shiraz" <Sh****@discussions.microsoft.com> schrieb im Newsbeitrag
news:47**********************************@microsof t.com...
I'm wondering if there is any other way to permanently set the location
the application to search the dlls in. Do you have any suggestions that

Not sure we are talking about the same, but this might give you an idea how
you could load the dll's 'dynamically':


Jan 19 '06 #2

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

Similar topics

by: Tom Dacon | last post by:
If you're not putting assemblies in the GAC, but are referencing shared code with copylocal=true into the projects that use them, is there any value to signing the assemblies? In the environment...
by: Dugan Zhang | last post by:
Previously I was building websites using asp. I have a folder name "projects", under the projects folder, I have number of subfolders, each subfolder represent a website I'm building. Inside each...
by: Mat | last post by:
My company develop about 5 products with .NET and VB6. Products use severals assemblies AND activeX.dll, which we update regularly but we still maintain the compatilibity. We would like to...
by: Shiraz | last post by:
Alright, I think I have a better perception of assemblies and environment variables now. The question I had initially posted was pertaining setting of environment variables using the VSI installer....
by: UJ | last post by:
I've got a program that runs on a machine that will automatically update things like the DLLs that a group of programs use. I'm looking at using the GAC because it's getting to the point that I...
by: daokfella | last post by:
I am creating a service that uses a few assemblies that are already existing...yet constantly being updated. I need to be able to use these libraries. Basically, I want to deploy my service on...
by: tony | last post by:
Hello! Is it correct to say as long as you are dealing with project that are buiding assembly dll it doesn't matter if the field Copy Local is set to True or if it set to False. This field...
by: navyliu | last post by:
I have raised a discussion about assembly unloading.But we can't get a final solution. Since we cannot unlaod a assembly,Is there any reference about this indicate that this problem won't make...
by: Jason | last post by:
Greetings , I'm studying for a MS exam and I'm a little confused about assemblies. Not what they are but just a specific comment that I'm reading and it doesn't make sense to me. It reads ...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.