msbuild / csproj exec任务问题

时间:2010-10-11 11:42:21

标签: c# msbuild

我在使用msbuild的构建服务器(2003)上遇到问题。我已经将问题缩小到csproj文件中的exec任务,我将其提取到一个非常简单的csproj(下面),但仍然没有快乐,请参阅'C:\ Documents'错误。这一切在我的本地机器上都没有问题。

我认为环境变量存在一些问题,但我无法理解。有什么建议吗?

输入


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Target Name="BeforeBuild">
   <Exec Command="echo hello world" />
  </Target>

</Project>

MSBuild输出

 D:\cc.net working\source\WebBase>msbuild ExecIssue.csproj
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 11/10/2010 12:37:50.
Project "D:\cc.net working\source\WebBase\ExecIssue.csproj" on node 1 (default t
argets).
BeforeBuild:
  echo hello world



'C:\Documents' is not recognized as an internal or external command,
  operable program or batch file.



D:\cc.net working\source\WebBase\ExecIssue.csproj(5,4): error MSB3073: The comma
nd "echo hello world" exited with code 1.
Done Building Project "D:\cc.net working\source\WebBase\ExecIssue.csproj" (defau
lt targets) -- FAILED.


Build FAILED.

"D:\cc.net working\source\WebBase\ExecIssue.csproj" (default target) (1) ->
(BeforeBuild target) ->
  D:\cc.net working\source\WebBase\ExecIssue.csproj(5,4): error MSB3073: The com
mand "echo hello world" exited with code 1.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.17

1 个答案:

答案 0 :(得分:1)

我会在诊断模式下运行它并将其发送到文件,然后在文件中搜索C:\ Documents。也许它在某些路径参数中使用“C:\ Documents and settings \”而不引用它。诊断模式将打印出大多数(如果不是全部)正在使用的属性,项目组,环境变量等。希望它会打印出exec任务正在使用的所有属性,因为你只提供命令参数,它正在为其余的使用一些默认值。

msbuild ExecIssue.csproj /v:Diagnostic > buildout.txt