Web 部署项目构建失败 (Visual Studio 2008)
我试图在 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 部署项目 - RTW 并安装了 Visual Studio 2008 的 Service Pack 1。
编辑:
在错误列表中,有 Error 1 The command "if exit ".\TempBuildDir\" rd /s /q " .\TempBuildDir\"" 退出,代码为 1。
。我不知道为什么它会出现 C:\Documents
因为该项目位于没有空格的文件夹中 (C:\Web\Projects\
)
它发生在一个全新的 Web 部署项目,通过右键单击网站并单击“添加 Web 部署项目”来创建。
编辑(1 月 29 日)。更详细的输出,每当使用
和 if exit
时都会失败:
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
I am trying to build a Web Deployment Project in Visual Studio 2008 and it keeps failing and I am not sure why. Error:
------ 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 ==========
I have the same project on another machine and it builds just fine. I have downloaded Visual Studio 2008 Web Deployment Projects - RTW and installed Service Pack 1 for Visual Studio 2008.
Edit:
In the error list, it has Error 1 The command "if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"" exited with code 1.
. I don't know why it is coming up with C:\Documents
as the project is in a folder without spaces (C:\Web\Projects\
)
It happens with a brand new web deployment project, created by right-clicking on the website and clicking Add Web Deployment Project
.
Edit (29 Jan). More verbose output, failes whenever <exec>
with if exist
is used:
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看这里:
http://social.msdn。 microsoft.com/Forums/en/tfsbuild/thread/9c14fd1c-4c6c-4a5b-ac2a-05a2972036e9
如果这不起作用,请在 Google 中搜索“MSB3073”,即您帖子中的特定错误代码。
祝你好运!
Look here:
http://social.msdn.microsoft.com/Forums/en/tfsbuild/thread/9c14fd1c-4c6c-4a5b-ac2a-05a2972036e9
If that doesn't do the trick, search Google for "MSB3073" the specific error code from your post.
Good Luck!
我认为您的项目构建到临时目录,然后将其复制到更永久的位置。
".\TempBuildDir\"
是一个相对路径,可能会导致构建成功的电脑上的非空格目录,但由于临时目录的位置(默认在 C:\Documents and Settings 中)。只是为了确定:检查您的电脑和其他计算机上的临时目录的位置。或者,如果可能的话,将 TempBuildDir 路径更改为更绝对的路径,例如 C:\Temp 或任何适合您的路径。
更具体地说:如果另一台计算机是 Vista 或 Win7 电脑,则 TempBuildDir 可能驻留在 C:\Users 目录中的某个位置。如果您的计算机是 WinXP 电脑,则 TempBuildDir 很可能位于 C:\Documents and Settings 中的某个位置。
I think your project build to a temp directory, after which it is copied to a more permanent location.
".\TempBuildDir\"
is a relative path which may lead to a non-spaced directory on the pc for which the build succeeds, but fails on your pc because of the location of your temp directory (default in C:\Documents and Settings).Just to be sure: check the location of the temp directories on your pc and the other machine. Or, if possible, change the TempBuildDir path to something more absolute like C:\Temp or whatever suits you.
To be more specific: if the other machine is a Vista or Win7 pc, the TempBuildDir might reside somewhere within the C:\Users directory. If your machine is a WinXP pc, TempBuildDir most likely resides somewhere in C:\Documents and Settings.
发现问题所在了。
用户配置文件文件夹中有一个 @ 符号,这看起来可能会破坏 MSBuild(因为 @ 对 MSBuild 具有特殊含义)。
用户配置文件文件夹为
C:\Documents and Settings\username@domain
,将其重命名为C:\Documents and Settings\username
解决了我遇到的这个问题。因此,文件夹名称中包含空格并不是失败的原因。Found out what the problem was.
The user profile folder had an @ sign in it, which looks like it may break MSBuild (since @ has a special meaning to MSBuild).
The user profile folder was
C:\Documents and Settings\username@domain
, renaming it toC:\Documents and Settings\username
fixed this issue I was having. So having spaces in the folder name was not the reason for the failure.