Wednesday, January 9, 2008

TFS Build Failure: MSBuild Tool missing sgen.exe

We're running TFS 2008 now at my client.  I installed the trial edition just to expedite things, as I'm not the one who works with the licenses.  (You can do an in-place upgrade of the trial to a live license.)  As I was getting the continuous integration build setup for our pilot project, I kept getting a build error similar to the following. 

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.


Some extensive searching only yielded this post, but I ignored the suggestion that followed the original posting... at first.  Turns out, it works quite fine.  Basically, you should have two registry keys under HKLM\SOFTWARE\Microsoft\Microsoft SDKs



image



The InstallationFolder value in the .NETFramework\v2.0 subkey is the thing we're after in the case.  Make an exact copy of that value under the Windows\V6.0A key.  I did this, as the previously mentioned post suggested, and things worked fine!



Mas Importante!  You may need to install the .NET Framework 2.0 SDK onto your TFS Server/Build Agent machine in order to do the above.

No comments: