简体   繁体   中英

Copying folders on post build in Visual Studio

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?

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM