IncrediBuild, ANT and TeamCity

I have a question regarding running ANT builds in TeamCity. I have an ant build that uses Xoreax Incredibuild to build our software. I can run this ANT task by itself and it runs fine, however running it from inside TeamCity gives me the following error


IncrediBuild Console 2.61 (build 687)


Build System Error----

Failed to initialize Build System:
Failed to load build environment.
Cannot open registry key: HKEY_CURRENT_USER\SOFTWARE\Microsoft\DevStudio\6.0\Build System\Components\Platforms\Win32 (x86)\Directories: The system cannot find the file specified


1 build system error(s)

Are there security limitations where TeamCity ANT builds can't access the registry? What user is it running as? I'm not sure what's going on as running the command listed in the build log by itself works fine.



This is not a TeamCity problem. It is a general environment problem.

It looks like the TeamCity is running as Local Service (or Network Service). Local Service has probably never opened Dev Studio, so the registry entries that Incredibuild requires are missing.

We got around this problem, by running an simple ant build from TeamCity that opens a command prompt. Note: You must make sure your TeamCity service can interact with the Desktop for this to work. Once the command prompt is open, you can launch Dev Studio. This will populate the registry.

Hope this helps,



I figured it was something with users and permissions. Thanks for the info!


Just a tip for anyone looking to do this (taken from

Just type
at XX:XX /interactive cmd.exe

where XX:XX is exactly one minute from now. Wait for the command line to pop up, then you can run anything you want such as "MSdev.exe" as the local system account.


You can also change the user under which the agent service (TeamCity Build Agent Service) is running. This can be done via standard Services console.

Best regards,

Yegor Yarko
Quality Assurance Engineer
JetBrains, Inc
"Develop with pleasure!"


Please sign in to leave a comment.