سؤال

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.

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

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.

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 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.

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.

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.

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top