Building via MSBuild fails when run as System User

1

We are using Visual Studio 2012 to build our C++ application If I run from the commandline in my source folder:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Release /p:Platform=Win32 Myproject2012.sln

it works fine. If it's run via the Buildscript of my buildserver (Atlassian bamboo) I get a lot of errors. The first two lines..

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: The "CL" task failed unexpectedly. [C:\data\bamboo-home\xml-data\build-dir\XXX-IMB-JOB1\XXX\common\common.vcxproj] 
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: System.TypeInitializationException: The type initializer for 'Microsoft.Build.Utilities.FileTracker' threw an exception. ---> System.IO.DirectoryNotFoundException: Das System kann den angegebenen Pfad nicht finden. (Exception from HRESULT: 0x80070003) [C:\data\bamboo-home\xml-data\build-dir\XXX-IMB-JOB1\XXX\common\common.vcxproj]

What can be the reason for this behaviour?

c++
msbuild
bamboo
asked on Stack Overflow Aug 28, 2013 by nobs

2 Answers

1

You can run the build outside of Bamboo as system if you use Sysinternals psexec.

psexec -i -s cmd.exe

Then try C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Release /p:Platform=Win32 Myproject2012.sln

Then create a shell that have elevated permissions and retry. Should help see if its a permissions thing or a path thing. Ive tried building C++ as system and it seems PK. Or it could be this: MSBUILD MSB4018 error

answered on Stack Overflow Aug 29, 2013 by James Woolfenden
0

I found the problem The System Account has a default temp directory which msbuild doesn't like I changed it to "c:\temp" no it works!

If someone else has the problem, you can change it in the registry

HKEY_USERS\.DEFAULT\Environment
answered on Stack Overflow Aug 30, 2013 by nobs

User contributions licensed under CC BY-SA 3.0