teamcity建设项目无法启动MSBuild.exe.路径中的非法字符 [英] teamcity building project Failed to start MSBuild.exe. Illegal characters in path
问题描述
我正在尝试在teamcity内建立一个项目.它将执行TFS检出,并且文件位于构建服务器本地.如果我在服务器上手动运行build命令,它将起作用:
I am trying to build a project within teamcity. It will do the checkout of TFS and the files are locally on the build server. If I manually run the build command on the server it works:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe C:\TeamCity\buildAgent\work\3446a5bd436eea87\Dev\Dev\project\myproj\myproj.csproj /t:build
在Teamcity内,我有一个MSBuild的构建步骤:
Within Teamcity I have a Build step of MSBuild:
构建文件路径为:Dev \ Dev \ project \ myproj \ myproj.csproj 工作目录留为空白 mbuild版本:Microsoft .net Framework 4.0 msbuild工具版本:4.0 运行平台:X86 目标:我尝试构建构建"并留空 命令行参数留空
the build fie path is: Dev\Dev\project\myproj\myproj.csproj" working directory left blank mbuild version: microsoft .net framework 4.0 msbuild toolsversion: 4.0 run platform: X86 targets: I have tried build "build" and left blank command line params left blank
如果我创建命令行构建任务并运行上面的命令行,它将起作用.我不确定teammcity的命令行和msbuild任务之间有什么区别.
if I create a command line build task and run the above command line it works. I am not sure what differences there are between the command line and msbuild task within teammcity.
编辑
我在工作目录上尝试了一些变体:
I have tried a few variations on the working directory:
项目中的输出路径设置为.. \ Build \ Tools \ myproj \
The output path in project is set to ..\Build\Tools\myproj\
因此,我已将teamcity中的工作目录设置为:Dev \ Dev \ project \ Build \ Tools \ myproj \
So I have set the working directory in teamcity to: Dev\Dev\project\Build\Tools\myproj\
这没有帮助.
这是teamcity的准确输出:
Here is the exact output from teamcity:
Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\TeamCity\buildAgent\work\3446a5bd436eea87\Dev\Dev\project\Build\Tools\myproj /msbuildPath:C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
in directory: C:\TeamCity\buildAgent\work\3446a5bd436eea87\Dev\Dev\project\Build\Tools\myproj
Failed to start MSBuild.exe. Illegal characters in path.
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.IsPathRooted(String path)
at JetBrains.TeamCity.Utils.FileUtil.MakeFullPath(String path, String workDir) in c:\BuildAgent\work\c2314fd21f15dc97\src\Utils\src\FileUtil.cs:line 48
at JetBrains.BuildServer.MSBuildBootstrap.RunArgs.get_ProjectFile() in c:\BuildAgent\work\c2314fd21f15dc97\src\MSBuildBootstrap\src\RunArgs.cs:line 156
at JetBrains.BuildServer.MSBuildBootstrap.Impl.MSBuildBootstrapFactory.Create(IClientRunArgs args) in c:\BuildAgent\work\c2314fd21f15dc97\src\MSBuildBootstrap.Core\src\Impl\MSBuildBootstrapFact ory.cs:line 29
at JetBrains.BuildServer.MSBuildBootstrap.Program.Run(String[] _args) in c:\BuildAgent\work\c2314fd21f15dc97\src\MSBuildBootstrap\src\Program.cs:line 67
推荐答案
在TeamCity中,当您使用参数作为路径或路径的一部分时,很容易粘贴到文件夹中,而不会注意到它具有最后换行或回程(从痛苦的经历中我发现).它可能会在TeamCity中显示为参数值:
In TeamCity, when you are using parameters for your path, or a portion of the path, it is easy to paste in a folder and not notice that it has a New Line or Carriage Return on the end (as I found from painful experience). It could show up in TeamCity as the value for a parameter:
\ Folder1 \ NewlyPastedInFolder \ ExistingFolder \ BuildScripts
\Folder1\NewlyPastedInFolder \ExistingFolder\BuildScripts
看起来像自动换行的值实际上是中间带有回车符的参数.通过编辑对其进行检查,然后查看是否可以删除该字符以使其成为单行值.
What looks like a word-wrapped value is actually a parameter with a carriage return in the middle. Check it by editing it, and see if you can delete the character to make it into a single-line value.
这篇关于teamcity建设项目无法启动MSBuild.exe.路径中的非法字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!