"Task failed because AXImp.exe was not found" when using MSBuild 12 to build a MVC 4.0 project
Asked Answered
B

13

24

I am trying to set up a build server using CruiseControl.Net and MSBuild. However, it's failing with the error:

 "C:\Builds\PremiumStore\checkout\PremiumStore.sln" (default target) (1) ->
    "C:\Builds\PremiumStore\checkout\Web\PremiumStoreWeb.csproj" (default target) (37) ->
    (ResolveComReferences target) ->
    C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(2151,5):     
    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\v8.1A\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

 3. Manually set

    the above registry key to the correct location.  4) Pass the correct location into the 
    "ToolPath" parameter of the task. 
    [C:\Builds\PremiumStore\checkout\Web\PremiumStoreWeb.csproj]

The same thing builds fine on my own machine, just not on the server.

I've tried searching all over the Internet for a solution but is unable to find one. If possible, I'd prefer not to have to install Visual Studio on the build server. It's kind of overkill to install an entire IDE just to do command line builds. I've installed the Microsoft Build Tools 2013 on that server but it does not seem to help.

I've tried to put in the path into the registry as suggested by the error message, but that didn't work either. I've also checked the path indicated in the registry and the aximp.exe is indeed present, but in a subfolder called "NetFx 4.5.1 Tools". However, copying the files from here one level up to the "bin" parent folder does not appear to help either.

If it helps, my build server runs on Windows Server 2012.

Thanks in advance.

Bondman answered 27/1, 2014 at 5:44 Comment(1)
Is this any use? #2986940Evasion
G
9

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

Gehman answered 9/6, 2014 at 21:42 Comment(2)
I eventually gave up and installed that and it works. Just thought it's kind of an overkill though.Bondman
I've tried installing the SDK but the .NET development tools are greyed out. This is supposedly due to .NET 4.0 not being installed, but .NET 4.5 is installed instead. Can I install a newer version of Microsoft SDK to get the .NET 4.0 aximp.exe?Allegra
E
7

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.

Eglanteen answered 22/1, 2019 at 10:18 Comment(1)
You save my day and also my hair :D Thanks!Thermal
A
4

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.

Aeronaut answered 31/1, 2017 at 13:55 Comment(0)
S
3

I solved my problem installing Windows 8.1 SDK

Shoulders answered 9/10, 2016 at 11:5 Comment(0)
P
2

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.

Profit answered 8/8, 2018 at 20:26 Comment(0)
C
2

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.

Chessy answered 8/1, 2019 at 21:48 Comment(0)
P
1

I no longer desire for my answers to contribute to stackoverflow, due to both their changes to the code of conduct and the unilateral use of our answers to train OpenAI.

Paphos answered 26/9, 2018 at 12:54 Comment(0)
W
0

I ended up using the following C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\msbuild.

I think the solution is to look for the msbuild inside your visual studio install. This is obviously only if you have visual studio installed, if you have a clean build server this is not good.

Westernism answered 20/2, 2020 at 11:23 Comment(0)
E
0

I had this same issue. I uninstalled and reinstalled the .NET Framework SDK tools for .NET 4.8, in my case. C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A was missing, after reinstall it was there and my code built successfully.

Eurythmic answered 9/3, 2021 at 17:38 Comment(0)
O
0

THis happened for me when I had a C# Winforms app and did not install the proper part of VS 2017 to allow creation of such projects. So ensure that you can create a new project of the same type if you get this error, and if not, go back to the installer and select the right projects.

Oby answered 12/5, 2021 at 18:10 Comment(0)
E
0

I have struggled with this problem for a few days.

  • Current SDK's installed in my pc: Windows SDK for Windows 11 (10.0.22621.755)

Here is how i fixed the problem.

  • Make sure you have latest or stable SDK's installed in your pc. If not then download and install Latest SDK's or Specific SDK's.

  • Check registry path (Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0A\NETFX 4.8 Tools) is added or not. For me v10.0A\NETFX 4.8 Tools is the latest SDK's.

  • If the above path is not found in your registry then add Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows this manually and after that add your SDK's version and NETFX 4.8 Tools version following the above way.

  • Get SDK's version: C:\Program Files (x86)\Microsoft SDKs\Windows\ from this path

  • Get NETFX 4.8 Tools version: C:\Program Files (x86)\Microsoft SDKs\Windows\{SDK's Version}\bin\ from this path.

  • Now add the below registry in your path according to your SDK's Version

ComponentName: Windows SDK Tools for .NET Framework 4.8

InstallationFolder: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\

ProductVersion: 10.0.22621.0

This should work in the right way.

If the problem still appear then add the below system environment variable in you user variable. Click New and set it

Variable Name: TargetFrameworkSDKToolsDirectory

Variable Value: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools

Endamoeba answered 21/11, 2022 at 11:29 Comment(0)
P
0

In my case I was trying to build a solution in windows container and was figuring out what Build Tools component I should install to fix this error with missing "AxImp.exe". Turns out it's the "Microsoft.Net.Component.4.8.1.SDK".

So this is my install script that I run to be able to build the solution without errors:

Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vs_buildtools.exe" -OutFile "C:\vs_buildtools.exe"

$arguments = @(
    "--quiet", "--wait", "--norestart", "--nocache",
    "--installPath", "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools",
    "--add", "Microsoft.VisualStudio.Workload.MSBuildTools",
    "--add", "Microsoft.NetCore.Component.SDK",
    "--add", "Microsoft.Net.Component.4.8.1.SDK"
);

Start-Process -Wait C:\vs_buildtools.exe -ArgumentList $arguments
Phototherapy answered 20/6, 2023 at 15:15 Comment(0)
K
0

I no longer desire for my answers to contribute to stackoverflow, due to both their changes to the code of conduct and the unilateral use of our answers to train OpenAI.

Kragh answered 9/11, 2023 at 16:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.