当Visual Studio告诉我“ xcopy以代码4退出”时,出了什么问题? [英] What is going wrong when Visual Studio tells me "xcopy exited with code 4"
问题描述
我对构建后事件不太熟悉,因此我对程序出了什么问题感到有些困惑。在Visual Studio 2010中进行编译时,我得到以下信息:
I'm not very familiar with post-build events, so I'm a little confused as to what's going wrong with my program. When compiling in visual studio 2010, I get the following:
The command "xcopy C:\Users\Me\Path\Foo.bar\Library\dsoframer.ocx C:\Users\Me\Path\Foo.bar\bin\Debug\ /Y /E /D
xcopy C:\Users\Me\Path\Foo.bar\ApplicationFiles C:\Users\Me\Path\Foo.bar\bin\Debug\ /Y /E /D
xcopy C:\Users\Me\Path\url\ C:\Users\Me\Path\Foo.bar\bin\Debug\ /Y /E /D
rmdir /S /Q C:\Users\Me\Path\Foo.bar\bin\Debug\.gwt-tmp" exited with code 4.
尽管出现此错误,程序似乎仍可以正常运行,但我不想忽略这个问题,并且希望没有坏事发生。奇怪的是,此行仅以单个命令(第一个xcopy)开始,但是随着我继续编译项目(修复其他问题,主要是引用),错误消息越来越大。知道发生了什么事吗?
The program appears to run fine, despite this error, but I don't want to just ignore this issue and hope nothing bad happens. Strangely, this line started out as only a single command (the first xcopy) but as I continued to compile the project (fixing other problems, mostly references) the error message expanded larger and larger. Any idea what could be going on?
编辑:以下是似乎在构建后的事件-
Here are the postbuild events that seem to be failing --
xcopy $(ProjectDir)Library\dsoframer.ocx $(TargetDir) /Y /E /D
xcopy $(ProjectDir)ApplicationFiles $(TargetDir) /Y /E /D
xcopy $(SolutionDir)com.myUrl.gwt\www $(TargetDir) /Y /E /D
rmdir /S /Q $(TargetDir).gwt-tmp
推荐答案
Xcopy退出代码4表示 发生初始化错误。没有足够的内存或磁盘空间,或者您在命令行上输入了无效的驱动器名称或无效的语法。
Xcopy exit code 4 means "Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line."
看起来Visual Studio提供的无效xcopy的参数。通过 Project>检查构建后事件命令。右键单击>属性>建立事件>构建后事件
。
It looks like Visual Studio is supplying invalid arguments to xcopy. Check your post-build event command via Project > Right Click > Properties > Build Events > Post Build Event
.
请注意,如果 $(ProjectDir)
或类似的宏展开时,术语在结果路径中有空格,然后将它们用双引号引起来。例如:
Note that if the $(ProjectDir)
or similar macro terms have spaces in the resulting paths when expanded, then they will need to be wrapped in double quotes. For example:
xcopy "$(ProjectDir)Library\dsoframer.ocx" "$(TargetDir)" /Y /E /D1
这篇关于当Visual Studio告诉我“ xcopy以代码4退出”时,出了什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!