When I build my solution with 10 Projects I get Build failures for 7 projects. All 10 Projects have post-build events. Even those who build use an xcopy command. I say this because my colleague was the opinion VS 2012 and xcopy is not that good...
These 7 build failures did not happen before.
The following error happens when I try to build the project or "from time to time" when I start my Visual Studio.
I get this error:
Error 1 The command "xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\Client" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\Client\" /s /e /v
xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\Content" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\Content\" /s /e /v
xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\Views" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\Views\" /s /e /v
xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\web.config" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\"
xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\global.asax" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\"
xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\Tools" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\..\Tools\" /s /e /v
" exited with code 9009. Swan.Replaced.Mobile.Web
I have googled a lot on SO and the main cause for this problem seem to be:
1.) A whitespace in the path/folder name
2.) The command does not get full paths
3.) Maybe some environment/system variables problem?
I can not see this error in my post-build event:
xcopy /y "$(ProjectDir)Client" "$(TargetDir)..\Client\" /s /e /v
xcopy /y "$(ProjectDir)Content" "$(TargetDir)..\Content\" /s /e /v
xcopy /y "$(ProjectDir)Views" "$(TargetDir)..\Views\" /s /e /v
xcopy /y "$(ProjectDir)web.config" "$(TargetDir)..\"
xcopy /y "$(ProjectDir)global.asax" "$(TargetDir)..\"
xcopy /y "$(ProjectDir)Tools" "$(TargetDir)..\..\Tools\" /s /e /v
My TargetDir is this outputpath:
..\build\web\bin\
My ProjectDir is this:
D:\Replaced\branches\ReplacedTest
comment: When I use xcopy on the console window thats totally fine.
These are my specs:
Windows 7 (64bit)
Visual Studio 2012 Premium
What I have tried to fix the issue:
Rebuild solution
Clean solution
wipe outputpath data
reboot computer
bite in the desktop
Nothing helped :/
Anyone can help please to spot the error? Thanks!
xcopy is usually located in C:\Windows\system32 so in order for VS to see xcopy this path should be in your PATH environment variable. You can check this by running:
echo %path%
in command line and you should see path to xcopy alongside other folders...
I just added C:\Windows\System32\ in front of the xcopy command and it solved things. In mean time also check that you didn't at some additional line breaks on accident. But if you like, you can also add the system directory back to your windows path. You can find this at computer - properties - advanced system settings - environment variables - system variables - path.
So for example:
C:\Windows\System32\xcopy /s /y "$(ProjectDir)bin\ken.MojoPortal.HtmlTools.Web.dll" "$(SolutionDir)Web\bin\"
P.S Originally posted here : https://ict.ken.be/xcopy-exit-with-code-9009-in-visual-studio-post-build
Related
In my project I have got following post-build Event:
xcopy "$(TargetDir)Data" "$(ProjectDir)Data" /Y /I
After the run has ended the program copies the files. But if in TargetDir/Data is a complete NEW file, this event does not copy the new file to ProjectDir/Data.
but I would like to have this new files copied to TargetDir/Data. How do I achieve this?
Thanks for help!
"Data" sounds like a directory, not a file. You'll have to create it first. You also appear to have reversed the arguments. Fix:
if not exist "$(TargetDir)Data" mkdir "$(TargetDir)Data".
xcopy "$(ProjectDir)Data\*.*" "$(TargetDir)Data" /Y /I /D
If you in fact meant to copy back to the project directory, very unusual, then just swap TargetDir and ProjectDir in the above snippet.
In wine and wineconsole when I try and move a file with the following command:
move /Y "file" "destination" I get the following error:
File already exists
and the file is not replaced. According to the windows help page http://technet.microsoft.com/en-us/library/bb490935.aspx /y should suppress the prompt asking if you wish to override the file, which it does, and also overwrite the file, which it fails at.
If I don't use /y it prompts me, after responding yes the file is overwritten. Can someone confirm the move command with /y is broken in wine (v1.6) and if so offer any suggestions while still using the move command.
As a temporary fix I perform a del /f/q on the destination before I move the file.
I want to create a bat file that will search for xml files from a folder and if one xml file is older than 10 days to show a pop-up message.
The idea is that I don't know how exactly I can do this with if and else.
I know that I can use
forfiles /p "path" /s /m *.xml /d -10 /c "cmd /c echo #file"
for searching the date for the xml files but how to show the message just in case one of the xml is older than 10 days ? In the other case no message.
This uses your forfiles command - it just changes it to require an enter when the file is echoed
#echo off
forfiles /p "path" /s /m *.xml /d -10 /c "cmd /c set /p var=#file"
exit
i use this script to compress all .txt and .cpi files into the backup folder in separated files with 7zip. After the files are zipped i delete the original files. However this script has a logical flaw. Lets say if the 7zip program fails to run, the files will also get deleted. How can i change the script so that it should not delete the files if they don't get zipped first. Also how can i change this script so it zips files that are older than 7 days? Thanks for your help.
#echo off
setlocal
set _source=C:\test7zip\bak
set _dest=C:\test7zip\bak
set _wrpath=C:\Program Files\7-Zip
if NOT EXIST %_dest% md %_dest%
for %%I in (%_source%\*.txt,%_source%\*.cpi) do "%_wrpath%\7z" a "%_dest%\%%~nI.7z" "%%I" & del "%%I"
pause
You seem to now more than me but i might be able to help....
Inside the 7zip you could a batch file that when unzipped changes a system varible...
The batch file (that you have already done) that unzips the files could check to see if variable is true before delete the files .... or something.?
Hope that helps in anyway?
For the zipping of the files witch are a certain days old... you could have a batch file that has a 7 day timer and that after the time is up it zips the certain directory of files into 7zip?
That's all i could help you with.
I didn't check or test your code thoroughly, but I did notice this right away. The "&" in the last line of your script creates a conditional command that will always execute the second command, regardless whether the 1st fails or succeeds. Change it to && to create a conditional command where the 2nd command only executes upon successful completion of the 1st, like this:
for %%I in (%_source%*.txt,%_source%*.cpi) do "%_wrpath%\7z" a "%_dest%\%%~nI.7z" "%%I" && del "%%I"
For including files older than 7 days, use the below changes to move them to a temp directory before zipping them:
set _source=C:\test7zip\bak
set _dest=C:\test7zip\bak
set _temp1=C:\test7zip\temp1
set _wrpath=C:\Program Files\7-Zip
if NOT EXIST %_dest% md %_dest%
forfiles /P %_source% /S /M *.txt /D -7 /C "cmd /c move #file %_temp1%"
forfiles /P %_source% /S /M *.cpi /D -7 /C "cmd /c move #file %_temp1%"
for %%I in (%_temp1%\*.txt,%_temp1%\*.cpi) do "%_wrpath%\7z" a "%_dest%\%%~nI.7z" "%%I" && del "%%I"
On my win32 system I had this command in Vim to open a vim file in wordpad:
silent ! start c:\Program Files (x86)\Windows NT\Accessories\wordpad.exe "%:p"<CR>
On my win64 system this doesn't work. I get this error:
error: Windows cannot find `"c:\Program"`
Maybe because of the space(s) inside "Program Files (x86)" and "Windows NT"?
How can i resolve this problem?
On 64-bit Windows wordpad.exe won't be in "Program Files (x86)", but in "Program Files". At least it is on my machine.
There are environment variables to find the folder names: "%ProgramFiles%" and "%ProgramFiles(x86)%".
Put quotes around your path.
Like so:
silent ! start "c:\Program Files (x86)\Windows NT\Accessories\wordpad.exe" "%:p"<CR>
Vim on Windows has a special !start (without a space in between) for asynchronous invocation.
And, as always, you need to put double quotes around the path, like this:
silent !start "c:\Program Files (x86)\Windows NT\Accessories\wordpad.exe" "%:p"