3
votes

I have a Visual Studio 2013 solution (MySolution2013.sln) containg a number of C# project using .NET 4.5.1.

When building MySolution2013.sln in VS2015 everything compiles fine.

When I run the following command from the command prompt:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe MySolution2013.sln

I get the following error for a C# procject containing a reference to a COM component:

C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (2015): 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\v8.0A\WinSDK-NetFx40Tools-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.

Anyone know what this is? The Windows SDK v8.0A in the registry part is a part of visual Studio 2012. Why would my VS2013 solution need parts of VS2012?

3
Because you are using the wrong version of MSBuild.exe. Use c:\program files (x86)\msbuild\12.0\bin\msbuild.exe instead. Or, preferably, the Visual Studio Command Prompt shortcut so all paths are set correctly.Hans Passant
The MsBuild command is part of a build step in TFS build and cannot be changed. I do not have VS2012 on the computer, but when using the path C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe the build works without errors. Unfortunately that does not help me.Helan

3 Answers

2
votes

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

1
votes

I had the same issue when I try to build the VS2015 solution file with Jenkins on Windows 2012 server after commit to SVN. Tried to copy AxImp.exe and related binaries and settings but failed. SO I had to install the windows 8.1 SDK and that made the successful build via Jenkins CI server. Hope this helps someone.