473,503 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Place DLLs in Subdirs

Hi,

i have writte 3 projects, 1 application (.exe) and 2 DLLs.
In the application i use the references to add the 2 DLLs to work with
their namespaces and functionallity.

But the application always copys the DLLs in its own diretory.
I want to have my own structure

e.g.:
C:.
¦---Application Directory
¦ +---Settings
¦ +---Dll Directory
And the application should look into the dll dir to find the DLLs, but
it only looks in its own directory and in the Windows system path...

Any idea how to make my application running in my preferenced directory
structur
greetz
Ecke
(Sorry for bad english :-))

Mar 1 '06 #1
5 1228
It's behavior by design to copy all dependend components to the currend
folder, due to security and robust reasons.
There are several ways to avoid it

1) put your dlls into GAC
2) use <codebase> of config file to specify location

Mar 1 '06 #2
I am not very experienced in VS2005.

I have two C++/CLR Projects where i create 2 namespaces (1 per dll).
First is the PCheck.dll with the Declaration:

#pragma once
using namespace System;

namespace CHECK{

// Class declarations...

}
And second is the PTry.dll with the Declaration:

#pragma once
using namespace System;

namespace TRY{

// Class declarations...

}
Then (in my Application) i used the Reference Link to Browse for the
DLL Files.
Then the VS2005 copys automatically the dlls in the temp dir of my
Application Project.
In my application code i wrote:

using namespace CHECK;
using namespace TRY;

// Rest of Form Code...

And now i compile my project. Everything works fine as long as the dlls
and the exe are in the same directory (the Debug dir), but when i copy
the dlls in a subdirectory (which is called dll), nothing works,
because the exe can't find the dll files, of course.

But what must i do to tell my application to search for the dlls in the
dll subdirectory.
Can you give me please a step by step explanation.
greetz and thanks
Ecke

Mar 1 '06 #3
In your App.Config file in the Configuration Section add something like
this:

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

The privatePath must be a sub-directory under the main application
directory. It cannot be elsewhere on the machine.

Mar 1 '06 #4
Sorry, but which config file?

I searched everything...

Or did you mean the *.vcproj File ?

Mar 2 '06 #5
For your UI app create new documet and choose App.config type from
newDocument window of VS
Afterward add codebelow into this config file. In Codebase node locate
your own dll path.

When app UI starts (after compile u will get Appname.config file nearby
your exe file), it will use this config file to load all dependent
components that are not in localdirectory/GAC reading <Codebase> node

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<codeBase version="2.0.0.0"
href="http://www.litwareinc.com/myAssembly.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
--
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche

Mar 2 '06 #6

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

Similar topics

5
3897
by: Florian Lindner | last post by:
Hello, how can I get all subdirectories of a given directory. os.listdir(dir) doesn't differentiate between directories and files, os.walk seems to me a bit overkill since it also descends in the...
3
1184
by: Chua Wen Ching | last post by:
Hi there, Is there any place to learn SecurityPermissins and Policy? I had looked into Code Access Security, but nothing much on using it. I want to implement in depth CAS into my dlls, and...
0
818
by: Neil | last post by:
I have an existing code base that I want to import into VS 7.1 C++. It has 200+ include files in 20+ subdirs. e.g. incl/package/classfile.h incl/package2/classfile2.h I want to add all of...
11
2271
by: Devender Khari | last post by:
Hi Friends, I'm facing a situation as follows, need help on identifying possible issues. There is an MFC application developed in VC6.0, say ABCVC6.exe and another developed in VC.NET, say...
0
3203
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
1
922
by: Georges Bessis | last post by:
Hi, My .Net App works fine, and its nice not to suffer "Dll Hell" : All my dlls are in the same directory as my executable. Now, for distribution purposes, I would like to put all these dlls...
2
1428
by: Evan Carmi | last post by:
hey, i am trying to move files with a specific file-ending (.msf) to dir above their current location. my code so far works as long as all the files are on the same dir level. but how can i...
1
1132
by: mjstenberg | last post by:
Im using a batch process function but found PHP to behave very strangely: It only reads subdirs that have caharacters in their names. Im having subdirs with integer names (0, 1, 2, 3.. ) but this...
10
1900
by: =?Utf-8?B?UmljaGFyZA==?= | last post by:
Hi, I usually deploy my ASP .NET application to the server by publishing, using Visual Studio 2005 publish feature. This creates the Bin folder on the server, with the compiled DLLs. I've...
0
7205
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
7287
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,...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.