Fixing Continuous Integration build for a .NET 3.5 project
My CI build fails with the following 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.
The research has brought quite a few posts about this problem, with Dan Händevik's being the most helpful and MSDN Forum's - the least (surprise, surprise). Unfortunately the proposed manual solution didn't work for me. I blamed it initially on my ambiguous x32/x64 server setup but all my attempts to trick the MSBuild didn't succeed and it kept reproducing that annoying error. I even tried to synchronize NAnt configuration with supposed SDK paths (BTW - there is an excellent post about tricking your NAnt 0.85 to run .NET 3.5 assemblies).
The exception itself is actually confusing - as it appeared afterwards, the mentioned registry key was still missing while build was running OK. My guess that it is hardcoded somewhere but it's hardly worth digging into the code with Reflector.
The only solution which eventually helped was to install the Windows SDK for Server 2008 and .NET Framework 3.5. I was confused by the download's title initially (our build runs on the Windows Server 2003) - but SDK didn't seem to harm anything (at least not yet). The installation is much smaller than suggested VS 2008 and now build is healthy (it is still failing for different reasons but that's another story - at least it passes the assembly stage).
No comments:
Post a Comment