DLL files location

  • Thread starter Thread starter Ivan
  • Start date Start date
I

Ivan

Hi All,

i found that all the referenced DLL files should be in the same folder of
the execute file
what can i do if i want all referenced DLL files located in a different path
to the execute file??

Thanks,
Ivan
 
Ivan said:
i found that all the referenced DLL files should be in the same folder of
the execute file
what can i do if i want all referenced DLL files located in a different path
to the execute file??

Hi Ivan,

have a look at the <assemblyBinding> and <probing>-tag in your
app.config file.

Reference:
http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfassemblybinding.asp

Explanation by Don Box:
http://www.awprofessional.com/articles/article.asp?p=30601&seqNum=6

Cheers

Arne Janning
 
Hi Arne Janning,

First of all, Thanks for ur reply
so i have to creat a configuration file which is the same name as my startup
executable file
like MIR.exe with MIR.exe.config with the following code
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:asm="urn:schemas-microsoft-com:asm.v1">
<runtime>
<asm:assemblyBinding>
<asm:probing privatePath="System;sPortal" />
</asm:assemblyBinding>
</runtime>
</configuration>

BUT one problem.. i put the configuration file in the same project with
MIR.exe but it seems not built..
i can't find the output file and it is not working...
did i do something wrong ??.. and what should i do to make it work??

Thanks,
Ivan
 
Ivan said:
First of all, Thanks for ur reply
so i have to creat a configuration file which is the same name as my startup
executable file
like MIR.exe with MIR.exe.config with the following code
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:asm="urn:schemas-microsoft-com:asm.v1">
<runtime>
<asm:assemblyBinding>
<asm:probing privatePath="System;sPortal" />
</asm:assemblyBinding>
</runtime>
</configuration>

BUT one problem.. i put the configuration file in the same project with
MIR.exe but it seems not built..
i can't find the output file and it is not working...
did i do something wrong ??.. and what should i do to make it work??

Hi Ivan,

MIR.exe.config does not have to be "built". Simply copy the
MIR.exe.config into the _same_ directory where your MIR.exe is.

With the example you provided the CLR loader will search your dll in
these directories:

APPDIR\yourdll.dll
APPDIR\yourdll\yourdll.dll
APPDIR\System\yourdll.dll
APPDIR\System\yourdll\yourdll.dll
APPDIR\sPortal\yourdll.dll
APPDIR\sPortal\yourdll\yourdll.dll

If your dll is culture-dependent (e.g. "en-US") then the CLR loader will
search in these directories:

APPDIR\en-US\yourdll.dll
APPDIR\yourdll\en-US\yourdll.dll
APPDIR\System\en-US\yourdll.dll
APPDIR\System\yourdll\en-US\yourdll.dll
APPDIR\sPortal\en-US\yourdll.dll
APPDIR\sPortal\yourdll\en-US\yourdll.dll

Is your dll located in one of these directories? If so it should work.

Cheers

Arne Janning
 
Arne Janning,

still not working.. but i'm sure ur method work fine.. i just don't know
which part i did wrong
let me tell u my structure in detail

C:\AppFolder <== this is the application folder which contains Main.EXE
(executable file) and Main.EXE.Config
that is:- C:\AppFolder\Main.EXE
C:\AppFolder\Main.EXE.Config
C:\AppFolder\System <== this folder contain all the dll reference files
including some dll files that Main.EXE referenced
that is:- C:\AppFolder\System\Kernel.Database
C:\AppFolder\System\Kernel.Global

Main.EXE.Config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<asm:assemblyBinding>
<asm:probing privatePath="System" />
</asm:assemblyBinding>
</runtime>
</configuration>

do u know where i make the mistake??
does it make any problem if Main.EXE contain reference to Kernel.Global ???

Many thanks,
Ivan
 
still not working.. but i'm sure ur method work fine.. i just don't know

When you add the config file to the project name it "app.config". When you
build the project, VS will AUTOMATICALLY rename the .config file
appropriately and copy it to the output folder.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Hi Chris,

Thanks for your reply,
What u said is correct but it doesn't make any help to make my program
works...
Is there any problem if the Main.EXE referenced to some DLL files which are
not in the same folder??
Or do you have any other idea?... I'm still struggling in it... sigh......

Thanks,

Ivan




Chris Dunaway said:
still not working.. but i'm sure ur method work fine.. i just don't
know

When you add the config file to the project name it "app.config". When you
build the project, VS will AUTOMATICALLY rename the .config file
appropriately and copy it to the output folder.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top