C# – Task failed because AL.exe was not found,

cvisual-studio-2008

I'm getting the following error when compiling my project:

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.

This error comes when I'm adding resource files to my folder in my UnitTest project. These resource files aren't directly used by my program for localization, they're just like normal files. I need them for unit testing some logic inside my program which loads these resource files using the ResXResourceReader.

Can someone explain me why this error comes up??

Edit:
Installing the Windows SDK solved the issue, as also described in the error. But I'd still like to know why the error appeared. I doesn't make sense to me.

Best Answer

You are getting this error because you are building a 3.5 project that uses an assembly manifest, but do not have the 3.5 tools installed. (Hopefully, someone can provide more information.)

I strongly recommend installing Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 and avoid the hacks, especially when you only need to install the tools, and be sure to check out the release notes for AL.exe information. (This SDK is the recommended installation for 3.5 due to a security update fix.)

The "Release Notes" for the SDK indicates that ALTOOLPATH is set by Visual Studio 2005, which might explain why some user have problems building. This is a guess on my part.

Using SysInternals' Process Monitor, when building a 3.5 project, Visual Studio 2008 looks in the %SystemRoot%\Microsoft.NET\Framework\v3.5 folder for the Assembly Linker (AL.exe). Failing to find AL there, it will use the location specified in the specific v6.0A registry setting. (Note that v6.0A is not for .NET 3.5.) Therefore, install the proper software and do not hack. :O)

The question I have is the Assembly Linker different between 2.0, 3.0, and 3.5?


Windows SDK for Windows Server 2008 and .NET Framework 3.5

Installing the newly released Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 instead of this release is recommended. If you do go ahead and install this SDK after VS2008 SP1, please ensure the patch described in Knowledge Base 974479 is applied. See Overview section for more information.

Related Topic