Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Visual Studio compile project references into a different folder then the main .exe

Tags:

c#

build

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

like image 658
Jon Kragh Avatar asked Feb 27 '09 20:02

Jon Kragh


1 Answers

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.

like image 158
foson Avatar answered Sep 28 '22 10:09

foson