tags:

views:

890

answers:

2

Hi SO,

I have a WPF Application project with several project references within a single solution in VS 2008. When I compile my solution, all of the referenced dlls are output into the same folder that the main .exe is output into.

Is it possible to configure my main .exe project build to output all references in a sub folder relative to my .exe?

I would like the final result to be something like this:

MyApp.exe MyApp.exe.config Lib\SomeReference.dll Lib\SomeReference2.dll

(I assume if this is possible, it would be possible with any .exe).

Thanks! Jon

+1  A: 

Move them to wherever you want in a post-build script.

ssg
+6  A: 

It looks like its a fairly intensive process.

First set the reference's Copy Local property to false so that the .dlls aren't copied to the bin\Debug folder .

Then create an assemblyBinding\probing element in your app.config to instruct the runtime to look for dlls in the Lib folder

Then create a post-build action to copy the necessary dlls to the \bin\Debug\Lib folder.

foson
may be it would be easier to leave Copy Local = true, but combine assemblyBinding\probing with moving *.DLL from $(TargetDir) to subfolder at post-build.
DK
If these are project references, I'd agree with you, but if these are just precompiled dlls, you may as well copy them from their source in the postbuild. Also, if you were creating an msi, you wouldn't want the dlls to be part of the primary output, which I believe they would be if CopyLocal=true.
foson
ah yes, thanks, I was thinking of project references. Referencing DLLs instead of projects is a bad karma, but 3rd-party DLLs and deployment project are excellent points.
DK