title: teamcity building project Failed to start MSBuild.exe. Illegal characters in path
body: <p>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:</p>
  
  <pre><code>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe C:\TeamCity\buildAgent\work\3446a5bd436eea87\Dev\Dev\project\myproj\myproj.csproj /t:build
  </code></pre>
  
  <p>Within Teamcity I have a Build step of MSBuild:</p>
  
  <p>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</p>
  
  <p>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.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have tried a few variations on the working directory:</p>
  
  <p>The output path in project is set to ..\Build\Tools\myproj\</p>
  
  <p>So I have set the working directory in teamcity to:  Dev\Dev\project\Build\Tools\myproj\</p>
  
  <p>This didn't help.</p>
  
  <p>Here is the exact output from teamcity:</p>
  
  <pre><code>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
  </code></pre>