【问题标题】:Web Deployment Project failing build (Visual Studio 2008)Web 部署项目构建失败 (Visual Studio 2008)
【发布时间】:2010-01-26 15:34:54
【问题描述】:

我正在尝试在 Visual Studio 2008 中构建一个 Web 部署项目,但它一直失败,我不知道为什么。错误:

------ Build started: Project: website_deploy, Configuration: Release Any CPU ------
if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"
'C:\Documents' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(92,7): error MSB3073: The command "if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"" exited with code 1.
Done building project "website_deploy.wdproj" -- FAILED.
========== Build: 1 succeeded or up-to-date, 1 failed, 0 skipped ==========

我在另一台机器上有相同的项目,它构建得很好。我已经下载了Visual Studio 2008 Web Deployment Projects - RTW 并为 Visual Studio 2008 安装了 Service Pack 1。

编辑:

在错误列表中,它有Error 1 The command "if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"" exited with code 1.。我不知道为什么会出现C:\Documents,因为该项目位于没有空格的文件夹中(C:\Web\Projects\

这发生在一个全新的 Web 部署项目中,该项目是通过右键单击网站并单击 Add Web Deployment Project 创建的。

编辑(1 月 29 日)。更详细的输出,每当使用 <exec>if exist 时都会失败:

Building with tools version "3.5".
Target "_PrepareForBuild" in file "C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets":
  Using "CreateProperty" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "CreateProperty"
  Done executing task "CreateProperty".
  Task "CreateProperty"
  Done executing task "CreateProperty".
  Task "CreateProperty"
  Done executing task "CreateProperty".
  Using "Exec" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "Exec"
    Command:
    if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"
    'C:\Documents' is not recognized as an internal or external command,
    operable program or batch file.
    C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(92,7): error MSB3073: The command "if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"" exited with code 1.
  Done executing task "Exec" -- FAILED.
Done building target "_PrepareForBuild" in project "website_deploy.wdproj" -- FAILED

【问题讨论】:

  • 看起来它不喜欢 C:\Documents and Settings 中的空间
  • C:\Documents 在解决方案或项目文件中的任何位置均未提及

标签: visual-studio-2008 web-deployment-project


【解决方案1】:

看这里: http://social.msdn.microsoft.com/Forums/en/tfsbuild/thread/9c14fd1c-4c6c-4a5b-ac2a-05a2972036e9

如果这不起作用,请在 Google 中搜索“MSB3073”,即您帖子中的特定错误代码。

祝你好运!

【讨论】:

  • 他们似乎没有任何帮助,因为它是由 Visual Studio 生成的文件
【解决方案2】:

我认为您的项目构建到临时目录,然后将其复制到更永久的位置。 ".\TempBuildDir\" 是一个相对路径,它可能会导致构建成功的 PC 上的非空格目录,但由于临时目录的位置(默认在 C:\Documents and Settings 中)而在您的 PC 上失败。

只是为了确定:检查你的电脑和另一台机器上临时目录的位置。或者,如果可能,将 TempBuildDir 路径更改为更绝对的路径,例如 C:\Temp 或任何适合您的路径。

更具体地说:如果另一台机器是 Vista 或 Win7 电脑,则 TempBuildDir 可能位于 C:\Users 目录中的某个位置。如果您的机器是 WinXP 电脑,TempBuildDir 很可能位于 C:\Documents and Settings 中的某个位置。

【讨论】:

    【解决方案3】:

    找出问题所在。

    用户配置文件夹中有一个 @ 符号,看起来它可能会破坏 MSBuild(因为 @ 对 MSBuild 有特殊含义)。

    用户个人资料文件夹是C:\Documents and Settings\username@domain,将其重命名为C:\Documents and Settings\username 解决了我遇到的这个问题。因此,文件夹名称中包含空格并不是失败的原因。

    【讨论】:

      猜你喜欢
      • 2023-03-06
      • 1970-01-01
      • 2013-11-09
      • 1970-01-01
      • 2018-12-08
      • 2011-01-30
      • 1970-01-01
      • 1970-01-01
      • 2010-09-06
      相关资源
      最近更新 更多