简体   繁体   English

msbuild / csproj执行任务问题

[英]msbuild/csproj exec task problem

I am having a problem on my build server(2003) with msbuild. 我在使用msbuild的构建服务器(2003)上遇到问题。 I have narrowed down the issue to the exec task in the csproj file,which I have extracted into a very simple csproj(below), and still no joy, see the 'C:\\Documents' error. 我已将问题缩小到csproj文件中的exec任务,我将该文件提取到一个非常简单的csproj(如下)中,但仍然不高兴,请参见“ C:\\ Documents”错误。 This all works with no problems on my local machine. 所有这些在我的本地计算机上都没有问题。

I think there is some issue with an environment variable, but I cant figure it. 我认为环境变量存在一些问题,但我无法弄清楚。 Any advice? 有什么建议吗?

Input 输入


<?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 output 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

I would run it in diagnostic mode and send it to a file and then search for C:\\Documents in the file. 我将以诊断模式运行它并将其发送到文件,然后在该文件中搜索C:\\ Documents。 Maybe it's using "C:\\Documents and settings\\" in some path parameter without quoting it. 也许它在某些路径参数中使用了“ C:\\ Documents and settings \\”而没有引用它。 The diagnostic mode will print out most if not all of the properties, item groups, environment variables, etc that are in use. 诊断模式将打印出大部分(如果不是全部)正在使用的属性,项目组,环境变量等。 Hopefully it will print out all the properties being used by the exec task, since you are only supplying the command parameter it is using some defaults for the rest of them. 希望它会打印出exec任务正在使用的所有属性,因为您只提供了命令参数,其余部分使用了一些默认值。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM