visual-studio-2012 - 命令 xcopy ... 在 Visual Studio 中以代码 9009 退出

标签 visual-studio-2012 build post-build-event build-error

当我用 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\

我的 ProjectDir 是这样的:
D:\Replaced\branches\ReplacedTest

评论:当我在控制台窗口上使用 xcopy 时,这完全没问题。

这些是我的规范:
  • Windows 7(64 位)
  • Visual Studio 2012 高级版

  • 我试图解决的问题:
  • 重建解决方案
  • 清洁解决方案
  • 删除输出路径数据
  • 重启电脑
  • 咬桌面

  • 没有任何帮助:/

    任何人都可以帮忙找出错误吗?谢谢!

    最佳答案

    xcopy 通常位于 C:\Windows\system32所以为了让 VS 看到 xcopy,这个路径应该在你的 PATH 环境变量中。您可以通过运行检查这一点:

    echo %path%
    

    在命令行中,您应该在其他文件夹旁边看到 xcopy 的路径...

    关于visual-studio-2012 - 命令 xcopy ... 在 Visual Studio 中以代码 9009 退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16730994/

    相关文章:

    visual-studio - 在 Visual Studio 生成后事件 : Access is denied 中复制文件

    c# - CS0234 : The type or namespace name 'WebPages' does not exist in the namespace 'System.Web' (are you missing an assembly reference? )

    visual-studio-2012 - vs2012 Web Essentials 不会在保存时自动编译更少的文件

    python - 如何创建用于离线安装的 debian 包?

    visual-studio-2010 - 在构建后事件中复制和覆盖文件的正确语法

    post-build-event - Eazfuscator.NET 仅在 SolutionConfiguration=Release 时工作

    c# - Crystal 报表: failed to open connection

    c# - 如何在 visual studio 2012 中生成 c# 文档到 chm 或 html 文件?

    build - 配置 Tensorflow 时,我应该在 "compute capability list"字段中输入什么?

    android - 如何解决 flutter 中的 build.gradle 错误。如何解决此错误 "A problem occurred evaluating project ' :app'. > Malformed\uxxxx 编码。”