-1

I have some files in my project that are used for unit testing, and than files that will be used in the actual release.

Currently have 'Copy to output directory' copy always turned on.

Is there a more direct way to send only certain files to the 'Release' directory and others to the 'Debug' directory when building?

Yogurt The Wise
  • 4,379
  • 4
  • 34
  • 42

1 Answers1

0

I ended using the command line build events property in the MAIN/Solution project. yourproject > properties > build events

Pre build event command line

First i cleaned out the directory

rd /s /q "$(TargetDir)Configs"

Post-build event command line

Next on Debug, copy all. And on Release, del everyting that was for testing.

if "$(ConfigurationName)"=="Debug" (
xcopy  "$(ProjectDir)Configs\*.*" "$(TargetDir)Configs\" /y
del  "$(TargetDir)Configs\_notes.*"
)
if "$(ConfigurationName)"=="Release" (
xcopy  "$(ProjectDir)Configs\*.*" "$(TargetDir)Configs\" /y
del  "$(TargetDir)Configs\test*.*"
del  "$(TargetDir)Configs\_notes.*"
)

IN the test Project, used the same PRE command. Had to change the POST command a little.

if "$(ConfigurationName)"=="Debug" (
xcopy  "$(SolutionDir)$(SolutionName)\Configs\*.*" "$(TargetDir)Configs\" /y
del  "$(TargetDir)Configs\_notes.*"
)
if "$(ConfigurationName)"=="Release" (
xcopy  "$(SolutionDir)$(SolutionName)\Configs\*.*" "$(TargetDir)Configs\" /y
del  "$(TargetDir)Configs\test*.*"
del  "$(TargetDir)Configs\_notes.*"
)

I think this could be slimmed down, but its working.

Yogurt The Wise
  • 4,379
  • 4
  • 34
  • 42