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
Within Teamcity I have a Build step of MSBuild:
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
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.
EDIT
I have tried a few variations on the working directory:
The output path in project is set to ..\Build\Tools\myproj\
So I have set the working directory in teamcity to: Dev\Dev\project\Build\Tools\myproj\
This didn't help.
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
Try editing the build configuration and remove the quotes from the Build file path option.
If you have:
"Dev\Dev\project\myproj\myproj.csproj"
Just let:
Dev\Dev\project\myproj\myproj.csproj
I hope this help.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With