4

I'm tyring to copy a folder from my Visual Studio 2015 Project's root directory into the output directory (as it breaks the application without it), so I decided to add xcopy to the post-build commands.

xcopy "$(SolutionDir)Content\*.*" "$(TargetDir)Content\" /s /i /y

I'm getting the following when it runs, and right now I can't even test this application because of xcopy.

1>  File not found - *.*
1>  0 File(s) copied
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: The command "xcopy "E:\Data\Projects\Vessel\Games\TheThing\Content\*.*" "E:\Data\Projects\Vessel\Games\TheThing\TheThing\bin\DesktopGL\AnyCPU\Debug\Content\" /s /i /y" exited with code 4.
Hyblocker
  • 101
  • 4
  • 11

1 Answers1

1

I'm also getting problems with Xcopy and postbuild events in visual studio from time to time. My fix is generally to create a batch script which contains the xcopy.

The batch script then is called by:

call "$(SolutionDir)scripts\copyfiles.bat"

as a post script event.

Willie
  • 352
  • 1
  • 3
  • 15
  • I ran the xcopy command (from the Visual Studio 2015 output) in cmd, and it still didn't work :( – Hyblocker Nov 06 '18 at 17:28
  • So I realised that instead of all that work, I could go to the all of the file's properties and set their "Copy to output Directory" from "Do not copy" to "Copy always" – Hyblocker Jan 01 '19 at 19:49