简体   繁体   中英

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.

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

The quotes around the $(TargetDir) are important if you have a space in any of your folder/file names

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