Task failed because “sgen.exe” was not found

visual-studio-2008windows 7

I am getting the following error when attempting to build my project in Visual Studio 2008 Professional Edition:

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 tried downloading Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5, and still get the error. I also tried downloading the Windows 7 SDK and .NET Framework 3.5 and still same result.

I also tried to manually editing the registry to change the InstallationFolder and I tried repairing the Visual Studio install.

The project was originally created on Windows XP and I am trying to compile on a reformatted machine running Windows 7 Enterprise.

Best Answer

copy /y “C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sgen.exe” “C:\WINDOWS\Microsoft.NET\Framework\v3.5\”

See the explanation here:

Related Topic