Post-build event command line does not work as expected

Topics: Developer Forum, User Forum
May 20, 2014 at 7:36 PM
I've been trying to run the following command at the post-build event command line text box and I always get an error:
XCOPY "$(OutDir)$(HtmlHelpName).chm*" "$(SolutionDir)MyProject\Resources\$(HtmlHelpName).chm*" /Y /C
I've tried many combinations... with or without asterisks, and switches and it either fails with "Code 4" or it doesn't copy the file. I've used this same command on other standard VS project templates and they all work fine. I've also tried the complete resolved command at the Windows command line and it works perfectly.

What is different in Sandcastle? Am I doing something wrong?

Also, I'm doing this because the "Help content output path" deletes all files in the destination folder by default, which has given me many hard times every time I forget! Can this be set to optional??? Through a checkbox maybe?? The default behavior in VS is not to delete, and leaves that to the user through the "Clean" command which is much more safer and convenient.

Any help or suggestions are very much welcomed.

Thanks!
Coordinator
May 21, 2014 at 2:27 AM
Some of the macros don't appear to be getting set. I'm not sure why so I'll have to look into it. The output folder will be cleared if building website output. If you want to build website output and Help 1 output, you can select both options on the property page. The content is cleared before the output is generated so both will end up in the output folder. The other alternative is to use the Output Deployment plug-in which can copy the content for each format to a location of your choosing.

Eric
Marked as answer by Guelo on 5/21/2014 at 3:18 PM
May 21, 2014 at 10:18 PM
Thanks for your fast response Eric! After I tried several combinations, I found out that "$(OutputPath)" gets resolved appropriately. Both variables should resolve to the same, but anyways... My code looks now like this:
XCOPY "$(OutputPath)$(HtmlHelpName).chm*" "$(SolutionDir)MyProject\Resources\$(HtmlHelpName).chm*" /Y /C
However, I think I'll go with the Output Deployment plug-in. I just tested it and it works perfectly well. Thanks!!!
Marked as answer by Guelo on 5/21/2014 at 3:19 PM