MSBuild on CI Server can't find AL.exe

34,338

Solution 1

As you have install the latest SDK (I'm assuming that's v7.1)

  1. Go to "Microsoft Windows SDK v7.1" from the Start menu
  2. Select "Windows SDK 7.1 Command Prompt" and enter
  3. cd Setup

  4. WindowsSdkVer -version:v7.1

This will tell msbuild to use that version of the tools without needing to do any scary registry editing.

Solution 2

Even though the question is quite old but it still appears in the top of google search results so I decided to post my solution as well. I have trapped into same issue while during TeamCity setup on Windows Server 2016 and Windows 10 Pro.

I have installed Microsoft Build Tools 2015 and Windows 10 SDK (Only tools for .NET 4.6.2) and got the error from question.

The missing puzzle was to set environment variable: TargetFrameworkSDKToolsDirectory=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools.

After setting environment variable MSBuild was able to resolve all needed tools including AL.exe and build succeeded.

Please let me know if same can be achieved by setting values in registry, but otherwise environment variables also works very well in this case and no installation of VS is needed.

Solution 3

You also need to apply the following registry fix to update msbuild to point to the V7.1 sdk values.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0]
"MSBuildToolsPath"="C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\"
"MSBuildToolsRoot"="C:\\WINDOWS\\Microsoft.NET\\Framework\\"
"FrameworkSDKRoot"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1@InstallationFolder)"
"MSBuildRuntimeVersion"="4.0.30319"
"SDK40ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1\\WinSDK-NetFx40Tools-x86@InstallationFolder)"
"SDK35ToolsPath"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1\\WinSDKNetFx35Tools@InstallationFolder)"
"MSBuildToolsPath32"="$(Registry:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0@MSBuildToolsPath)"

Solution 4

I had the same problem there, here's my simple answer to this.

After you have installed the Microsoft Windows SDK 7.1 on the TeamCity Server.

In Regedit Change this key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0\SDK40ToolsPath

to

$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools-x86@InstallationFolder)

Solution 5

Follow the below steps. This worked perfectly to me. Saved my time.

1- Right-click the My Computer icon and choose Properties, or in Windows Control Panel, choose System.

2- Choose Advanced system settings.

3- On the Advanced tab, click Environment Variables.

4- Click New to create a new environment variable under User variable section.

5- Variable name: TargetFrameworkSDKToolsDirectory

6- Variable value: TargetFrameworkSDKToolsDirectory=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools

Variable value depends on your SDK installation path. enter image description here

7- Click OK and Save all windows.

8- Restart Visual Studio.

Share:
34,338
Tim Long
Author by

Tim Long

I am a freelance software developer and IT professional. I trade as Tigra Astronomy and Tigra Networks. As a software developer I currently specialize in producing firmware and Windows software to control astronomical instruments and devices and I have worked with a number of well-known brands that sell equipment to amateur astronomers. Some of the brands I have worked with to produce shipping commercial products include NexDome, Optec, Gemini Telescope Design, AWR Technology, Technical Innovations. I have also produced one-off solutions for several private individuals and institutions. I am a member of the steering group for The ASCOM Initiative which produces standards and interoperability software used by almost all software available to amateur astronomers, and lately some universities and government departments. This work is purely voluntary but highly rewarding, because the impact of ASCOM on amateur astronomy cannot be overestimated. ASCOM was historically Windows-only but is currently undergoing a transformation to a network-centric cross-platform technology. With my IT hat on, I support several organizations with servers, cloud services and CCTV security systems. I am active mainly with arts companies such as Music Theatre Wales and conservation charities such as Thanet Countryside Trust and Pwll Du Cave Management Group, where I am a trustee. I was awarded Microsoft MVP ('Most Valuable Professional') for Windows Small Business Server in 2007, 2008 and 2009. I prefer to develop in C# and try to be an early adopter of the latest tools and techniques, where it makes sense. CodeMentor Twitter @Tim_Long Google+ Facebook LinkedIn timlong

Updated on July 09, 2022

Comments

  • Tim Long
    Tim Long almost 2 years

    I'm having a problem on my TeamCity CI build server where during compilation I get the following error:

    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2342, 9): error MSB3086: Task could not find "AL.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed

    I've found similar reports from a year ago when people were upgrading to .NET 3.5, for example this one. In that case, installing the latest SDK solved the issue, however I have already installed the latest SDK (Microsoft Windows SDK for Windows 7 and .NET Framework 4) on my build server. The MSBuild tools are all there on the server, in a folder called

    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319

    and AL.exe exists in

    C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools

    However the registry key mentioned in the error message does not exist. So, it seems like there is something wrong with the installation/configuration of MSBuild. This error only happens for projects that have embedded resources, which require AL.exe.