visual-studio-2010directoryreleasepost-build-event

User VisualStudio PostBuild with place-marker


After successfully build, I want to copy the content of the the folder to the destination. I've learned that this will work fine:

copy "$(TargetPath)" "$(TargetDir)\..\..\..\TB-Annotation Editor\bin\Debug\Plugins\$(TargetFileName)"

But I am interested to copy all *.exe, all *.dll and all *.txt files into the destination and this could cost a lot of lines for each plugin. Now I wanted to ask if there is any possibility to use place-marker instead of fixed filenames.

this does not work and raise event "Error Code 1"

copy "$(TargetDir)*.*" "$(SolutionDir)bin\Debug\plugins\"

Regards

I'm very sorry, seems to be not an error because of the "*" but of the folder which is called same twice:

copy "$(TargetDir)*.*" "$(SolutionDir)MyProject\bin\Debug\plugins\"

Goes correct to:

"copy 
"C:\Daten Laptop\PAG\Net\MyProject\Solution\Plugins\DSP - Alphablend\bin\Debug\DSP - Alphablend.exe" 
"C:\Daten Laptop\PAG\Net\MyProject\Solution\MyProject Main\MyProject Main\bin\Debug\plugins\DSP - Alphablend.exe""

But when using ".dll" instead of ".*" (DLL does not exist, because at the moment it is selected as *.exe) it does throw error code 1 again.


Solution

  • To my mind the best way of doing this is setting file properties and project properties. This requires no additional lines at all. If you set "output folder" property for project, "copy local" flags for referenced libraries and change "Build action" and "Copy to output directory" properties for your txt files (they should be included to solution) you get what you want.