AxImp .NET4.0 runtime mismatch AxImp .NET4.0 runtime mismatch wpf wpf

AxImp .NET4.0 runtime mismatch


I found one solution to this problem.

You have to specify which SDK version MSBuild should use. If you add the following extra commandline parameter it will work (at least in my situation).

/p:WindowsSDKVersionOverride=v7.1

Apparently MSBuild tries to use v7.0A version by default, which is not installed on my buildserver. It somehow then decides to just ignore everything and fall back to .NET 2.0 paths. I found this out by removing the 2.0 version of AxImp. It then complains about the folllowing:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1558,9): error MSB3091: Task failed because "AxImp.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for "AxImp.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. 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.

That registry key is not present on my buildserver. So if you add the v7.1 version override it will look at the right registry keys and use the correct tool versions.


I solved my problem installing Windows 8.1 SDK

In my case, I was trying to compile a .csproj using MSBuild on a CI Windows 2012 R2 server (CI stands for Continuous Integration), although the most relevant web's issues on this subject suggested to install Windows SDK, they failed pointing EXACTLY which one.

So, at first, I guessed they mean Windows 10 SDK, which is also the right version for Windows 2012 server. Unfortunately, Windows 10 SDK does not include the missing AxImp.exe SDK file.So, as you can imagine, it took me quite a while to figure out that Windows 8.1 SDK was the key to this riddle.

Again, hope it helps someone else ;-)