【发布时间】:2013-05-24 08:48:51
【问题描述】:
当我使用 10 个项目构建解决方案时,我发现 7 个项目的构建失败。所有 10 个项目都有构建后事件。即使是那些构建的人也使用 xcopy 命令。我这么说是因为我的同事是 VS 2012 的意见,而 xcopy 不是那么好......
这 7 次构建失败以前没有发生过。
当我尝试构建项目或启动 Visual Studio 时“不时”发生以下错误。
我收到此错误:
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
我在 SO 上搜索了很多,导致这个问题的主要原因似乎是:
1.) A whitespace in the path/folder name
2.) The command does not get full paths
3.) Maybe some environment/system variables problem?
我在构建后事件中看不到此错误:
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
我的 TargetDir 是这个输出路径:
..\build\web\bin\
我的项目目录是这样的:
D:\Replaced\branches\ReplacedTest
评论:当我在控制台窗口上使用 xcopy 时,这完全没问题。
这些是我的规格:
- Windows 7(64 位)
- Visual Studio 2012 高级版
我尝试解决的问题:
- 重建解决方案
- 清洁解决方案
- 擦除输出路径数据
- 重启电脑
- 咬桌面
没有任何帮助:/
谁能帮忙找出错误?谢谢!
【问题讨论】:
标签: visual-studio-2012 build post-build-event build-error