问题
On a 64 bits Windows 7 machine, I installed .Net framework 4.5.1 and Windows SDK for Windows 8.1 from http://msdn.microsoft.com/en-us/windows/desktop/aa904949.aspx
While attempting to build a solution, I get the following errors (that seem to be related):
error MSB3086: Task could not find "AL.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\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
error MSB3091: Task failed because "resgen.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for "resgen.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\v7.0A\WinSDK-NetFx35Tools-x86. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK. 2) Install Visual Studio 2010. 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 the suggested solutions (except installing VS: not allowed on that machine), many others found on the Internet, such as reinstalling the SDK, perform some hacks in the registry, set environment variables, add tags in the project, attempt many command line switches to the msbuild process, and followed these threads:
Running MSBuild fails to read SDKToolsPath
Failing Build because it can't find AL.exe
tfs 2012 build task failed because "resgen" was not found
but none of them solved the problem.
This question looks similar to:
https://stackoverflow.com/q/23655387/1288109
that has no answer!
Any suggestion would be appreciated!
回答1:
Although the setups for the SDK sayd that it was up to date, probably it was not. I finally solved the issue by removing all installed versions of SDK, then installing the following, in this order:
http://www.microsoft.com/en-us/download/details.aspx?id=3138
http://www.microsoft.com/en-us/download/details.aspx?id=8279
http://msdn.microsoft.com/en-us/windows/desktop/hh852363.aspx
http://msdn.microsoft.com/en-us/windows/desktop/aa904949.aspx
I just point out that there could be some other related issue: after having installed all the above, I finally had another kind of error saying, for some projects (targeting framework 3.0), that the output path was not specified. It WAS instead specified as bin\release. I replaced it with bin\$(Configuration)\ and my solution finally built.
See also:
https://stackoverflow.com/a/26123890/1288109
来源:https://stackoverflow.com/questions/26114183/msbuild-fails-msb3086-msb3091-al-exe-resgen-exe-not-found