“Task failed because AXImp.exe was not found” when using MSBuild 12 to build a MVC 4.0 project

限于喜欢 提交于 2019-12-03 06:12:49

The thing they recommend as step 1 ("install the Microsoft Windows SDK") is the correct advice. Install the Microsoft Windows SDK.

For Windows 10 I installed "Microsoft Windows SDK" 8.1, but that didn't help me.

So I followed by 3) option in error description: Manually set the registry key.

Opened "regedit" command from CMD and found location (as exception suggested) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A
The folder "WinSDK-NetFx40Tools-x86" was absent, so I created it and fulfilled with the following keys:

ComponentName: Windows SDK Tools for .NET Framework 4.0
InstallationFolder: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\
ProductVersion: 8.0.50727

P.S.: be sure, that in "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\" you have AxImp.exe

By the same algorithm you may try with another version - v8.1A.

I struggled for a long while with this. I must've installed sixteen different things and tried twenty different versions of the registry key answer ("Task failed because AXImp.exe was not found" when using MSBuild 12 to build a MVC 4.0 project). In the end I figured out that I'd been using buildtools v14 when I should've been using 15. So instead of using C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe, I used C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe, and then the error disappeared.

I solved my problem installing Windows 8.1 SDK

This is still an issue that I have seen today, and I discovered that when I would attempt to compile the application within Visual Studio, it compiled correctly, but running the MSBuild.exe from C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe generated this error.

After installing the .NET 4.7.2 SDK and still having the same issue, I discovered that there are other instances of MSBuild.exe.

I changed our build script to use C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe instead and the issue "magically" went away.

To solve this problem, I installed windows sdk 10, 8 and 7, and I changed registry to point to the correct position where AxImp.exe locates. But unfortunately, I still got the same error.

I just occasionally found using MSBuild 14.0 rather than 4.0 (C:\Windows\Microsoft.NET\Framework\v4.0.30319) can build my project successfully.

To use MSBuild 14.0, you need to config the path in environment variable.

In order to get around this problem, I had to go through the following steps.

  • I had to install the Windows SDK (version 7.1, in my case), but it would not install because of the reason dealt with in this question;
  • I then proceeded to modify the registry keys detailed in the answer to that question, but I got the 'Error writing the value’s new contents.' message;
  • I proceeded to follow this guide (also linked in the comments to the answer of the aforementioned question) in order to modify the registry keys anyway;
  • I was then able to install the Windows SDK, and I then manually created the registry key being looked for, making sure that the "InstallationFolder" value points to the newly created SDK folder (in my case, "C:\Program Files\Microsoft SDKs\Windows\v7.1").

This allowed me to overcome this error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!