Click to See Complete Forum and Search --> : [RESOLVED] How can exe find dlls in sub directory


tim.deboer@imowa.com.au
October 10th, 2008, 03:37 AM
Hi All

I have an application that works fine when the executables and dlls are all deployed to the one directory. My Sys Admin has asked however that I put my dlls into a lib directory under the app directory (seems fair enough to me!) but....

How do I do this??? The exe doesn't just "discover" the dlls and I can't find anything to tell me how to build the application to make sure it can find them.

I'm sure this is easy to do yet I've searched for ages and now find myself with woe in my heart.

Working directory structure is

[ProgramDir]
- Program.exe
- lib1.dll
- lib2.dll

Non working directory structure is

[ProgramDir]
- Program.exe
- [Lib Dir]
- lib1.dll
- lib2.dll

tim.deboer@imowa.com.au
October 12th, 2008, 09:14 PM
Boo Hoo :.( am I all alone on this one? Please help...

dannystommen
October 16th, 2008, 03:59 AM
add the next part to your app.config file:


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

where 'lib' is the directory where your dll's can be found

for more information about this:
How the runtime locate assemblys:
http://msdn.microsoft.com/en-us/library/yx7xezcf(VS.80).aspx

the <probing> element:
http://msdn.microsoft.com/en-us/library/823z9h8w(VS.80).aspx

tim.deboer@imowa.com.au
October 16th, 2008, 04:06 AM
Brilliant! And so easy! Just tried it and it just worked.

Thanks a lot dannystommen