将项目工件复制到成功构建事件批处理文件上的 bin 文件夹
我想在成功构建时将项目文件和文件夹复制到 bin\debug 文件夹。 我正在尝试让 xcopy 执行此操作,但它要么复制 0 个文件,要么告诉我它无法循环复制。
我想做的与此类似 问题: 这是我的批处理文件:
@echo off
REM Set up the files and folders to exclude
echo \bin\ > exclude.txt
echo exclude.txt >> exclude.txt
echo Helper.cs >> exclude.txt
echo Program.cs >> exclude.txt
REM Set up the variables
set sourceBase="D:\Devprojects\WebApplications\GenerateTabbedHTML"
set destinationBase="D:\Devprojects\WebApplications\GenerateTabbedHTML\bin\Debug\"
set params=/E /C /I /R /Y /Exclude:exclude.txt
xcopy %sourceBase% %destinationBase% %params%
我的处理方式正确吗?或者有更简单的方法来完成这个任务吗?
I'd like to copy project files and folders to the bin\debug folder on successful build.
I'm trying to get xcopy to do it, but it either copies 0 files or tells me it can't copy cyclicly.
What I'm trying to do is similar to this question:
Here's my batch file:
@echo off
REM Set up the files and folders to exclude
echo \bin\ > exclude.txt
echo exclude.txt >> exclude.txt
echo Helper.cs >> exclude.txt
echo Program.cs >> exclude.txt
REM Set up the variables
set sourceBase="D:\Devprojects\WebApplications\GenerateTabbedHTML"
set destinationBase="D:\Devprojects\WebApplications\GenerateTabbedHTML\bin\Debug\"
set params=/E /C /I /R /Y /Exclude:exclude.txt
xcopy %sourceBase% %destinationBase% %params%
Am I going about this the right way? Or is there an easier way to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来 xcopy 不喜欢您的目标文件夹位于源文件夹内这一事实。你确实排除了它,但我想它无论如何也无法处理这种情况。尝试使用不在源代码下的中间文件夹。首先将文件复制到那里,然后再复制到目标。
Looks like
xcopy
doesn't like the fact that your dest folder is inside your source folder. You do exclude it, but I guess it can't handle the situation anyway. Try using an intermediate folder, which is not under the source. Have the files first copied there, and then to the target.