Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Always Copy" solution content (DLLs) to executable directory root

By way of background, I'm trying to get one of the Emgu CV examples working. It is the Motion Detection example mentioned in the answer to "Looking for a function for motion detection on emgucv"

To get the example code working I need to add references to the Emgu CV DLLs to the project and also make sure that the relevant Open CV DLLs are copied to the output executable directory of the project build. The relevant DLLs are listed on the EMGU wiki.

I'm adding the Open CV DLLs by adding them as content to the example project and marking them as "Copy always" in the content properties:

Content properties in VS2012 set to "Copy always"

I do not want these cluttering up the root level of the project so I have added a project folder to put these DLLs in:

Solution Explorer showing project folder with DLLs in

However when I build the project the DLLs are copied with the same directory hierarchy, i.e. they have an enclosing folder within the execution directory which I do not want:

File Explorer showing directory containing the DLLs

What properties do I need to set to ensure that the DLLs are copied into the execution directory but into its root rather than in a sub directory?

========== EDIT ==========

Note that I cannot add these DLLs as references to the project as they are neither .Net assemblies nor COM components but the Open CV C++ libraries.

like image 632
dumbledad Avatar asked Sep 24 '13 15:09

dumbledad


1 Answers

Talking to another developer at work he uses another workaround. He keeps the DLLs in a project folder and then adds a post-build event in the project's property pages to copy the DLLs into the directory with the executable:

copy/b/y "$(ProjectDir)Libs\*.dll" "$(TargetDir)"

user7116's advice and my colleague's are great workarounds but I'm going to leave the question open just-in-case someone discovers (or Microsoft adds) a way to actually set properties on the content files to ensure that the DLLs are copied into the root of execution directory rather than in a sub directory.

like image 97
dumbledad Avatar answered Oct 21 '22 07:10

dumbledad