0

Lets say I have a project solution, I want to copy the contents of bin/Release folder after the build into another folder named "Deploy"

Source:      D:\Solution\bin\Release
Destination: D:\Destinationfolder\bin\deploy

the macros are as follows

TargetDir :   D:\Solution\bin\Release
ProjectDir:   D:\Solution

I have tried this

xcopy /? $(TargetDir) $(ProjectDir)\..\Bin\Deploy /R /Y /S

This is not working. Am I doing anything wrong? Is there any other way to do this?

CJBS
  • 15,147
  • 6
  • 86
  • 135
harin04
  • 271
  • 5
  • 16
  • Related: http://stackoverflow.com/questions/11001822/copy-files-from-one-project-to-another-using-post-build-event-vs2010 – CJBS Feb 13 '15 at 07:07

2 Answers2

0

Remove the /? from the xcopy command, and add quotes around paths. The .. will take the $(ProjectDir) path back to D:, so the Destinationfolder should also be added.

So: xcopy "$(TargetDir)" "$(ProjectDir)\..\Destinationfolder\Bin\Deploy" /R /Y /S

CJBS
  • 15,147
  • 6
  • 86
  • 135
  • Not working. :( The release folder contains some other folders within it , lets say folder1 , folder2 , this folder structure is not available in the deploy folder .Is this causing the problem ? – harin04 Feb 13 '15 at 07:14
  • What do you mean by 'not working'? What's the error or output that you get? Or what is the output that you're getting vs what you expect to get? – CJBS Feb 13 '15 at 07:39
0

I would suggest you to create a Publish Profile. If you want to build the project to a desired folder you can simply right click on the project and click Publish.

Claudio P
  • 2,133
  • 3
  • 25
  • 45