简体   繁体   English

在VS 2017中添加预构建命令以将文件复制到项目

[英]Adding pre-build commands to copy files to a project in VS 2017

I have a folder which has a bunch of scripts in it. 我有一个文件夹,里面有一堆脚本。 These are NOT in a project or solution. 这些不在项目或解决方案中。

What I need to do is using the pre-build event in VS, is copy these files using xcopy into the debug folder of a project. 我需要做的是在VS中使用pre-build事件,就是使用xcopy将这些文件复制到项目的debug文件夹中。

I have worked out how to do this with stuff inside a solution or project. 我已经解决了如何使用解决方案或项目中的内容执行此操作。 But trying to do it with external files is eluding me 但是试图用外部文件做到这一点使我难以理解

Can anybody point me in the right direction please? 有人能指出我正确的方向吗?

Projects have a Pre-build event that can be used for doing what you are looking to do. 项目有一个预构建事件,可用于执行您想要做的事情。

You can find this in the Project Properties in the Build Events section. 您可以在“构建事件”部分的“项目属性”中找到它。 Try the command as per: 尝试按照以下命令:

c:\windows\system32\xcopy D:\source\*.* "$(TargetDir)" /s /e

For a list of the Build Parameters see MSDN: https://msdn.microsoft.com/en-us/library/42x5kfw4.aspx 有关构建参数的列表,请参见MSDN: https : //msdn.microsoft.com/zh-cn/library/42x5kfw4.aspx

The quotes around the $(TargetDir) are important if you have a space in any of your folder/file names 如果任何文件夹/文件名中都有空格,则$(TargetDir)周围的引号很重要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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