Friday, 20 April 2012

“sgen.exe” error while setting up Team City Build Server

I’ve recently set up a local build server for LeaveWizard and came across an issue:

“C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2249, 9): error MSB3086: Task could not find "sgen.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed”

After a bit of Google searching the answer was pretty simple, just download the latest version of the Windows SDK and then install the .NET Development Tools, simples Smile.


I came across the same issue whilst installing another build server, this time it was on a Windows 2008 Server. I installed the SDK as stated previously but I was still getting the problem. It seems that the registry key for v7.0A just did not exist. Further Googling identified that you can configure which SDK version should be used by performing the following steps:

Go to “Start | All Programs | Microsoft Windows SDK 7.1” and start the “Windows SDK 7.1 Command Prompt”.


cd Setup
WindowsSdkVer.exe –version:v7.1

Now re-run your build and hopefully the problem has gone away, if not good luck finding the issue.


Unknown said...

Thanks for the solution it works....

Unknown said...

Thanks for the Solution ,if i change the version to v7.1 in command prompt than its works fine.