MSBuild error “C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1993,9): error MSB3091: Task failed because “sgen.exe” was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for “sgen.exe” in the “bin” subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5. 2) Install Visual Studio 2008. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the “ToolPath” parameter of the task.”

I fought for a couple of minutes with this error and I thought to share with you my solution.

The error was on my build machine which wasn’t having Windows SDK and I wasn’t planning to install it either.

I was having HKLM\SOFTWARE\Microsoft\Microsoft SDKs\.NETFramework\v2.0 key and the InstallationFolder key with the value C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\ so I thought about adding the key that was normally generated by Windows SDK.

So, I added HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A key with the InstallationFolder key pointing to the same value as above and copied the missing sgen.exe into the bin\ folder under the above mention location.

I queued a new build a everything worked like a charm.

I hope this helps,
Bogdan

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: