MSBuild on CI Server can't find AL.exe - winapi

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.

As you have install the latest SDK (I'm assuming that's v7.1)
Go to "Microsoft Windows SDK v7.1" from the Start menu
Select "Windows SDK 7.1 Command Prompt" and enter
cd Setup
WindowsSdkVer -version:v7.1
This will tell msbuild to use that version of the tools without needing to do any scary registry editing.

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.

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)"

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)

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.
7- Click OK and Save all windows.
8- Restart Visual Studio.

I have a simple, effective fix.
The problem seems to be that the tools version delivered with Visual Studio is version 7.0A, while the version delivered with the Windows SDK is version 7.1. That's all very well, but MSBuild.exe is still looking for the version 7.0A registry keys, which don't exist. This has to be a bug!
Looking in my registry, all the information for V6.0 and V7.1 is present and correct. So my solution is simple. I created a registry link that makes an alias of the 7.1 keys.
It's not possible to create registry links using the built-in tools, so I downloaded a little utility called 'regln' from here.
C:>regln-x86.exe "\Registry\Machine\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" "\Registry
\Machine\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1"
Job done. MSBuild now works perfectly on the TeamCity server.

Add a system env variable TargetFrameworkSDKToolsDirectory
like this:
TargetFrameworkSDKToolsDirectory=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools
restart VS

Ran into the same issue setting up a new build server on Windows 10.
Found and installed the latest (at the time) Microsoft Windows SDK for Windows 7 and .NET Framework 4 and that solved the problem.

We recently had this problem trying to get our .Net 4.0 builds working. We found that the location of al.exe had changed between where the original MSBuild that came with .Net 4.0 looks, and the Visual Studio SDK for .Net 4.0 (which was released later).
Since the only standalone installation of the SDK tools available is the one we had already installed without success (the one you mentioned), the only solution we could think of was to install Visual Studio on the build agents. We put Visual Studio 2010 Express (to keep the installation as lightweight as possible) on there and the problem went away. Not a pretty solution, but it did work - installing VS2010 also installs the SDK tools of the specific version that MSBuild appears to be looking for.
This is a problem that really shouldn't happen, but there didn't seem to be a way of making MSBuild look in the correct place for the tools, even hacking around in the registry.

Related

The C# project is targeting ".NeETFramework, Version=v4.0", which is not installed on this machine

Trying to run an old project in Visual Studio 2015. It was created in 2012 or 2013, I cannot remember which. I have uninstalled both programs as I was running out of space, and i think that is what caused this. I get the following options:
And I do not want to change the target, so clicking on the second option brings me to https://www.microsoft.com/net/targeting which I can't seem to find anything there that remedies the situation. Is there a way around this without reinstalling the old version of Visual Studio again? Will that even fix my problem? Thank you.
Just Reinstall Visual Studio. When you uninstalled previous version it caused this problem.
You could try doing a repair reinstall of Visual Studio 2015.
Another point to consider is that Windows 7 (the oldest version of Windows still supported by Microsoft) includes a Windows Update for the .NET Framework v4.6.1 categorized as an "Important" update. I have not confirmed with Windows 8, but I suspect it, too, includes a similar update. Windows 10 comes with .NET 4.6 to start with. That means that any up-to-date supported machine today will be able to run apps targeting any .NET version up to and including 4.6. I recognize that there may be other reasons to continue targeting an older .NET version, but I bring this up just in case the concern is support on client workstations.

How to install WinDbg when VS 2015 is already installed?

I'm trying to install WinDbg from this page, just under the Debugging Tools for Windows 10 (WinDbg) section. However, when I download the executable and run it, it tells me that
You must uninstall the Windows Software Development Kit - Windows 10.0.10586.15 before you can install the latest version of the kit.
I'm guessing this probably has to do with the fact that I already have VS 2015 (and the Windows 10 SDK) installed. However, when I go to the Developer Command Prompt and type in
> where windbg
it tells me that it can't find WinDbg. How, then, do I install it without doing anything drastic (like reinstalling Visual Studio)?
I just ran into this same problem (with a slightly newer version of the SDK) when setting up a VM with Windows 10 and Visual Studio 2015. Following the general rule (or at least, what used to be the general rule), I installed Visual Studio first before attempting to install the SDK.
Even though I picked all the options in the Visual Studio install, and I appear to have gotten large portions of the SDK, I didn't get the debugging tools or the application verifier, which I wanted. The "Debuggers" folder was empty. Yet when I tried to download and install the standalone Windows 10 SDK, I got the error message you quote, that I needed to uninstall the SDK before I can install the latest version.
Microsoft's site is absolutely no help. It gives no clues about the appropriate way to install the software. Harry Johnston's comment got me going in the right direction.
After installing Visual Studio 2015, you already have the Windows 10 SDK. You do not need to download it separately. To get the additional tools on Windows 10:
Open Settings → System → "Apps and features".
Scroll down to "Windows Software Development Kit".
(I had two versions of it installed. The top one was newer. I'd recommend that you proceed with the newer version for the following steps.)
Select it, and click "Modify". Then, because it's Windows 10 and everything is harder than it needs to be, click "Modify" again.
The installer will launch. Select the "Change" option, and click "Next".
Place a check next to the additional features/tools you want, click "Change" to start the process.
After waiting some time, it will have downloaded and installed the additional portions of the SDK. You should now be good to go!
(This does seem like a bug in my case. The two versions of the SDK (the one I have installed and the one whose installer I downloaded) are identical (both are for version 10.0.10586.212), so running the standalone installer should just launch the same setup tool that you are able to launch from Settings, enabling me to Change/Remove Features. Oh well, at least this works.)

How to install Xamarin.Android for Visual Studio Enterprise 2015 offline

I want to install Xamarin for Android Development in Visual Studio 2015 Enterprise.
While installing, Xamarin told me that I was missing a lot of features, so it would download and install them for me. The download size was around 2GB, and I have a really slow internet.
I wanted to know if there is a way to download Xamarin and all required components separately, using some download manager like IDM, and then be able to use it later to re-install/install on another PC.
Also, I was able to find offline setups for JRE and JDK, and also Android Studio and Android SDK/NDK, but still, the download size is around 1.5GB, which I presume is for the required Android SDK libraries, APIs and tools.
So, I am just asking for a guide on downloading all the components and store them for installing later.
According to the official docs (whose pictures are outdated, by the way) you should login to your account and then head to the download page where you could find links to different versions of Xamarin.
I did so, but all that's available there are older versions of Xamarin Studio and the universal installer. Similar searches on the Xamarin Forums yielded no results as well.
There's a way to find the direct URL for each installer by checking the XML used by the Platform Installer (located at \AppData\Local\Temp\Xamarin\downloads\InstallationManifest.xml). I haven't tested whether installing them separately will work or not, but it probably will. Just make sure to install them in the right order (and to install the Android SDK/NDK after installing Xamarin.Android)
Here are the links to the latest versions, as of today:
Xamarin.Android
Android SDK
Android NDK (x64)
GTK#
Xamarin Studio
Xamarin for Visual Studio
It'd be good if someone with a Mac could help me find the URL for Xamarin.iOS, but that's a start :P
You can download this XML file and find the link of latest version of all required components.I did this and the latest links are :
Java JDK 1.7
Android SDK 24.4.1
NDK 10 (32) or NDK 10 (64)
Xamarin for Visual Studio 2015 4.1.2.18
Intel HAXM 6.0.1
Microsoft MSBuild Tools 2015.0
You don't even need to login for download them.
After 1st web install, backup %tmp%\Xamarin\downloads\ , then on a new Windows:
Uninstall Java 1.8 if exists.
Manually install Java JDK 1.7u71 + GTK# + Android SDK (Install for anyone).
Extract NDK to "C:\Program Files (x86)\Android\android-ndk-r10e", or make NTFS junction to it (not to run out of C: space later).
Run XamarinInstaller having just *.zip files in %tmp%\Xamarin\downloads\, when you see that current download is "XamarinStudio", disconnect Internet (you can delete the NDK now).
When you see above the progress bar: "Downloading Xamarin Studio", you can close the web installer.
Manually install Xamarin.VisualStudio, and if you want, XamarinStudio.
Step 4 require Internet, but noting to download.
To make NTFS junction, from "C:\Program Files (x86)\Android" prompt:
mklink /j android-ndk-r10e T:\android-ndk-r10e
where T: can be USB drive, but not Network drive.
I know it's a link only answer (copyright!), but there are step-by-step instructions including screenshots of how to do that:
Installing Xamarin Made Easy with Offline Installation
I've not tried it, but it should help you.
Found this:
http://ionemind.com/content/get-direct-download-links-xamarin
Links to XML files with direct links to necessary components for Xamarin, including Xamarin for Visual Studio (version 4.5, for VS 2013 and 2015).
Another link I found:
https://dl.xamarin.com/XamarinforVisualStudio/Windows/Xamarin.VisualStudio_4.8.0.1289738.msi
I had installed Xamarin Studio 5 and then it autoupdated its components (to Xamarin Studio 6.3 and the mentioned VisualStudio Tools 4.8).
Then in the "AppData/Roaming/Xamarin X.X" I found a folder for temp downloads. There was the MSI file.
Then I just searched for this exact MSI name to get a direct link.
(on this site https://itblogdsi.blog.fc2.com/blog-entry-23.html)
There's actually some info about releases and MSI names and it has Xamarin.VisualStudio_4.9.0.1538920.msi so replace this part in the MSI link above.
It's for VS 2015 only.

VS2013 - Msbuild fails Error MSB3086: Could not find AL.exe

I've recently upgraded to Windows 10 and i've stumbled upon an error when trying to build my solution in Visual Studio 2013 Ultimate.
The error is as follows:
Error 1 Task could not find "AL.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools-x86". 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 Common.Resources
So the one thing that came to mind is to download / install the Windows 8.1 & 10 SDK, this didn't solve this issue however. The error is referring to Microsoft SDK v8.1a; Shouldn't it refer to v10.0?
So I opened up regedit and looked at the key location and the v10.0 folder is missing and the v8.1a folder is empty.
There are a couple of keys that when created should fix this error, i've tried creating them manually aswell but this didn't fix it either.
So, I tried changing the sdk toolset, there's supposed to be a option I should be able to change, so I opened the solution properties > Configuration Properties > Changed Configuration to 'All Configurations'. and the General node appeared to be missing...
All of this happened after upgrading to windows 10, it messed up the sdk toolset somehow, i've done alot of research for this problem and I couldn't find a proper solution. Any ideas?
I've managed to solve this problem; I decided to remove all the intalled SDKs then reinstall the latest Windows 10 SDK. Then I cleaned my solution and it built succesfully afterwards!

VS2005 and Windows SDK 7.1

Running the WindowsSdkVer.exe shipped with Platform SDK 7.1 does not work.
None of the .BAT files in VS 2005 get updated.
can anyone please tell me how to correct this?
Also, how do I verify that VS2005 is using Platform SDK 7.1?
There are several articles for this in MSDN but none of them for above configuration.
Also, none of them describe the concrete way / definate way of verifying this
You could try to manually set the include and lib paths of the VS environment under
Tools->Options->VC++ Directories
or something like that (it's been a while).
For verification, you can add the /showIncludes parameter to the additional compiler options of the project, and /verbose:lib to the additional linker options to double check that the correct headers/libraries are being used when compiling/linking the project.
IIRC there was some kind of incompatibility between one of the newer versions of the SDK (could have been version 7) and using VS2005, but I can't recall off hand what that was.
You can use below method for using Windows SDK 7.1 with Visual Studio 2005.
Configuring Visual Studio for Visual C++ Development with the Windows SDK
In the link , you can find the contents with
"To use the Windows SDK Configuration Tool in Visual Studio 2008".
Even though it has such title, you can use the same procedure also for VS2005.
Start the Windows SDK Configuration Tool by clicking Start, then All Programs, then Microsoft Windows SDK v7.1, and then Visual Studio Registration.
Right-click Windows SDK Configuration Tool and then click Run as
administrator.
In the Windows SDK Configuration Tool, in the list, select v7.1.
Click Make Current.

Resources