VS PostBuild事件-复制文件(如果存在) [英] VS PostBuild Event - Copy file if it exists

查看:297
本文介绍了VS PostBuild事件-复制文件(如果存在)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法可以在Visual Studio项目的构建后事件中复制文件,但前提是该文件存在? (即,如果文件不存在,请不要使构建失败)

Is there a simple way to copy a file in a post-build event for a Visual Studio project, but only if the file exists? (i.e. don't fail the build if the file doesn't exist)

我已经尝试过使用xcopy进行一些选择.但是我感觉很愚蠢-我似乎无法理解xcopy可能需要的开关.

I've tried some options using xcopy. But I feel so stupid - I can't seem to get my head around what switches I might need with xcopy.

推荐答案

使用"IF"命令:

IF EXIST file.txt xcopy file.txt [destination_folder]\ /Y

这篇关于VS PostBuild事件-复制文件(如果存在)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆