40

I am getting the following error, which I don't understand. Any suggestions?

Error 1 The command "xcopy "D:\Users\johndoe\Documents\Visual Studio 2008\Projects\MyProject\MyProject.Modules.Ribbon\bin\Debug\MyProject.Modules.Ribbon.dll" "D:\Users\johndoe\Documents\Visual Studio 2008\Projects\MyProject\MyProject\bin\Debug\Modules\" /Y" exited with code 9009. MyProject.Modules.Ribbon

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
David Veeneman
  • 18,912
  • 32
  • 122
  • 187

10 Answers10

34

I encounted this error on the TeamCity build server. I finally resolved it after checking the build log and found:

"'xcopy' is not recognized as an internal or external command."

I then changed my statement to:

C:\Windows\System32\xcopy "$(ProjectDir)config\Web.config.$(ConfigurationName)" "$(ProjectDir)Web.config" /Y/R

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
Jobrocol
  • 856
  • 10
  • 12
  • 8
    xcopy worked good for me yesterday, today I had to use %windir%\system32\xcopy – lvmeijer May 09 '13 at 10:28
  • 3
    When I tried configuring the Java, may PATH variable Control Panel\System and Security\System -> Environment variables were modified. I guess that's why xcopy command was not understood. Now it works ! thanks. – Santoo May 10 '13 at 05:44
  • This worked for me, thanks. Xcopy was not on the path for some reason. – bobasaurus Mar 13 '17 at 19:39
  • You can add C:\Windows\System32 to your system PATH variable. – user1958681 Aug 24 '23 at 18:04
32

Restart Visual Studio. Worked for me

user3875275
  • 357
  • 3
  • 2
21

Found my answer: The command had a line break between the source and destination strings. So, Visual Sudio was treating it as two commands. Eliminating the line break solved the problem.

David Veeneman
  • 18,912
  • 32
  • 122
  • 187
11

This error can occur if your system PATH environment variable has been set incorrectly. The path should contain (at the very least)

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;

on modern versions of Windows (see https://superuser.com/questions/124239/what-is-the-default-path-environment-variable-setting-on-fresh-install-of-window). I have just found my system PATH had been set to

C:\Program Files (x86)\Bad Vendor\Buggy Program;

by an msi installer that obviously has issues.

If you don't know how to edit the PATH via the System Properties dialog, check out this link : http://support.microsoft.com/kb/310519 - it's basically the same in Windows 7 & 8 as it is in XP.

Finally, it's worth noting that a lot of programs don't notice if you update the PATH while they are running, so closing down and re-opeing programs like Visual Studio or command prompt windows will be required for the repaired path to take effect.

Community
  • 1
  • 1
RobinG
  • 369
  • 2
  • 6
4

Your xcopy command failed for some reason.

I would guess that either the DLL file doesn't exist (eg, the build failed) or the target path doesn't exist.

Run the same command line in a command prompt and see what error it prints.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
2

Thanks for your help.

I gave complete path of xCopy and it worked for me.

%windir%\system32\xcopy

%windir%\system32\xCopy "$(ProjectDir)app\ExtjsWS\build\*.*" "$(publishUrl)\app\ExtjsWS\build" /y /i/e</PostBuildEvent>

Barry
  • 3,303
  • 7
  • 23
  • 42
RaviK
  • 81
  • 1
  • 2
1

Even though its a old post, I found fix which may help some one.

What not helped me

Restarting visual studio.
Restarting computer
tried few steps as above and few more blogs

I am using Visual Studio 2013.

What helped me.

Check the Environmental Variables check the PATH, does it has all or nothing or only a part.

since I was having backup of System PATH, I just copy-pasted the variables Under

System Variables -> Path.

At last, I gave rebuild to the project voila! it worked for me.

Manjuboyz
  • 6,978
  • 3
  • 21
  • 43
1

In my case: i fix it do this: Add value %SystemRoot%\system32 to Environmental variable's Path variable,and restart my computer,rebuild the solution,it goes fine.

pduan
  • 41
  • 6
0

Mostly related to path C\Program files...\some.exe. It should be "C\Program files...\some.exe"

Mahesh Malpani
  • 1,782
  • 16
  • 27
0

windows defender was blocking access for me, because I get so many of these silly push notifications I was just ignoring it during the build process. Click the notification and allow access for xcopy. Problem solved

chris c
  • 321
  • 2
  • 14