Problems

Compile a Class Library project, you received this error

C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1993,9):
error MSB3091:
Task failed because "al.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for "al.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.

Or

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.

 

Solutions

- Manually add a registry key http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/71f6b1fc-2e22-4ced-9825-469beb4381eb/)

  • Copy & paste following to NotePad:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A]
"InstallationFolder"="C:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0\\"

  • Then rename the file extention to vsfix.reg.
  • Double-click the file you just created then choose "Yes".
  • You're done. :)

- Add a system environment variable : http://bhaidar.net/cs/archive/2007/12/25/al-exe-not-found-solution.aspx

Some more links I have just know

  1. http://dukelupus.wordpress.com/2008/02/05/task-failed-because-sgenexe-was-not-found-solution/
  2. http://wiki.evident.nl/Default.aspx?Page=Task%20failed%20because%20sgen.exe%20was%20not%20found&AspxAutoDetectCookieSupport=1