[英]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" 可以说我有一个项目解决方案,我想在构建后将bin / Release文件夹的内容复制到另一个名为“ 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. 从xcopy
命令,并在路径周围添加引号。 The ..
will take the $(ProjectDir)
path back to D:
, so the Destinationfolder
should also be added. ..
将把$(ProjectDir)
路径返回到D:
$(ProjectDir)
因此还应该添加Destinationfolder
。
So: xcopy "$(TargetDir)" "$(ProjectDir)\\..\\Destinationfolder\\Bin\\Deploy" /R /Y /S
因此: 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 . 如果要将项目构建到所需的文件夹,只需在项目上单击鼠标右键,然后单击“ 发布”即可 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.