XCopy is not working (File not found *.*) - cmd

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.

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.

Related

The command exited with code 2 visual studio 2017

While I'm trying to build my windows application, I'm getting following error.
The command
"C:\repos\CommunityLive\CL_GateApp\signing\StrongNameUnsignedAssemblies.bat
C:\repos\CommunityLive\CL_GateApp\signing" exited with code 2.
Following is my Pre-Build event command line
$(ProjectDir)signing\StrongNameUnsignedAssemblies.bat $(ProjectDir)signing\
Here is the Macros details
Xcopy command without /y can cause this:
This post-build event exited with Code 2:
xcopy $(TargetDir)*.* $(SolutionDir)shared\ /s /i
This worked as hoped:
xcopy $(TargetDir)*.* $(SolutionDir)shared\ /s /i /y

using XCOPY copy a file over to Program Files(x86) folder with permission

xcopy "C:\RS\Automation - Reporting Service\CW\bella_%date:~4,2%-%date:~7,2%-%date:~10,4%.SLS" "C:\Program Files (x86)\Common Files\Countwise\Retail_Reporting\DATA" /e /y /h
xcopy "C:\RS\Automation - Reporting Service\CW\bella_%date:~4,2%-%date:~7,2%-%date:~10,4%.HRS" "C:\RS\Automation - Reporting Service\CW\bevello_%date:~4,2%-%date:~7,2%-%date:~10,4%.HRS" /e /y /h
I keep getting an error saying that I system file path cannot be found. This only occurs when the script is run as a scheduled task.
The directory is exist and it seems like problem with user permission.
Can anyone help?
Thanks!

XCopy will not copy in visual studio

I'll copy a exe into another folder with a post build event from visual studio. This should happens every build. I haven't any errors, the exe output is in a custom folder, but it will not copy into another folder, why? The build output from visual studio is only: Build successfully. 0 files copied.
With this script, I've changed the output folder: $(SolutionDir)..\..\build\$(ProjectName)\. And with this, I'll try to copy the result into another folder: xcopy "$(SolutionDir)..\..\build\$(ProjectName)\$(TargetFileName)" "$(SolutionDir)..\..\bin\AutoCopy-Server.exe*". With the "*" at the end, I say, that it is not matter, if this is a file or a directory. What's wrong here? The file in my output folder, is successfully "copied". It seems, that xcopy can't find the file, but there isn't any error. Has someone an idea?
It sounds like this xcopy bug. If so, a workaround is to append <NUL: to the end of the xcopy command, eg:
xcopy "$(TargetDir)\*.exe" "$(SolutionDir)\bin\" /S /Y <NUL:

XCOPY and VS 2013 Post-Build Errors

As much as this topic has been talked about, I would think that someone else has run into the same issue as me and found a solution.
This XCOPY Script works in another environment using VS 2012 (with macros) and the same environment using the command line.
XCOPY "C:\Web.Forms\bin\Web.Forms.dll" "C:\inetpub\WebSite\bin" /Y /R
XCOPY "C:\Web.Forms\UserControls\*.ascx" "C:\inetpub\WebSite\usercontrols" /Y /R
It keeps throwing an error of 4 and does not copy within VS 2013. If I change it to "COPY" I get an error of 1. For the purpose of testing and to use it in the command line I stripped it of all Macro's. Actually, I used the [macro] generated directory strings from the error message successfully in the command line.
So why doesn't this work in Visual Studio 2013? VS is running as Administrator.

Post-build event can't be executed

I've converted an old Visual C++ 6.0 project to a new Visual C++ 2010 one. It functions but I have a problem with the post build event which I took from the old project. It registered the target file (an .ocx) on the computer:
copy $(ProjDir)\PDFXChange\dll.Debug\*.* $(TargetDir)
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
In my new solution it doesn't work. I've also tested it in single commands: of the three commands (copy, regsvr32 and echo) only the last one could be executed. What could be my error.
Error:
error MSB3073: The command "copy \PDFXChange\dll.Debug\*.* C:\_tests_\ocx2010\Debug\
regsvr32 /s /c "C:\_tests_\ocx2010\.\Debug\LayoutBox.dll"
echo regsvr32 exec. time > ".\Debug\\regsvr32.trg"
:VCEnd" exited with code 3. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets
COPY and REGSVR32 seem not to work.
The problem was in the name of the macro $(ProjDir). In Visual C++ 2010 it's $(ProjectDir)
$(ProjDir) -> $(Proj ect Dir)
Some macros altered their names (after so many years)!
The command copy \PDFXChange\dll.Debug*.* C:tests\ocx2010\Debug should copy some DLLs into the folder where the next command regsvr32 /s /c "C:tests\ocx2010.\Debug\LayoutBox.dll tried to register the target file. It couldn't find any DLLs there, so it quit with the error message.
Mismatch between
Project->Properties->Configuration Properties->General->Output Directory
and
Project->Properties->Configuration->Linker->Output File
I made the former like so...
$(SolutionDir)$(PlatformTarget)$(Configuration)\
and in the linker like so..
$(SolutionDir)$(PlatformTarget)$(Configuration)$(ProjectName).dll
and it solved the problem

Resources