Visual C Build Issues
If you experience any problems running a Visual C++ build on a build agent, you can try to workaround these issues with the following steps, sequentially:
Make sure you are not using mapped network drives.
Make sure the build user have enough rights to access necessary network paths.
Sign in to the build agent machine under the same user as that of the build and try running the following command:msbuild.exe <path to solution.sln> /p:Configuration:Release /t:Rebuild
Ensure that the Build Agent service runs under the user with local administrative privileges.
Check that Microsoft Visual Studio is installed on the build agent.
Note that you have to start Visual Studio 2005 or Visual Studio 2008 under the build user at least once.
If "Error spawning cmd.exe" appears, put the following lines exactly into the list in Tools | Options | Projects and Solutions | VC++ Directories:--$(SystemRoot)\System32 --$(SystemRoot) --$(SystemRoot)\System32\wbem
Add all environment variables from
...\Microsoft Visual Studio 9.0\VC\vcvarsall.batto the environment or to the Build Agent Configuration.
Ensure all paths to sources do not contain spaces.
VCBuildUserEnvironment=truein the runner properties.
VCBuildAdditionalOptionsproperty with the value
/useenvin the build configuration settings to instruct MSBuild to add the
/useenvcommand-line argument for spawned VCBuild processes.