I got the following error when MSBuild.exe builds a C# project.
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\NETFXSDK\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.
- Windows 10 Enterprise 64 bit
- Node.js V12 32 bit
- TypeScript + C#
- Edge.js (To use C# code from Node.js)
- Using MSBuild.exe directly as a compiler instead of Visual Studio
When does the error occur
When MSBuild.exe tries to build the C# project
The following solutions are from the error message.
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.
There are 4 possible solutions described in the error message. I used Visual Studio 2022 but why is VS 2010 required here…?
Anyway, none of them worked.
The following registry path is shown in the message but it doesn’t work even if I added the entry here.
It turned out that it is the wrong place for 32-bit.
The correct path is the following.
The entry must be under
v8.0A\WinSDK-NetFx40Tools-x86 depends on the version that you use. Check your error message and adjust the name accordingly. The path after
WOW6432Node should be the same as the error message.
If the error message shows
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10, then the desired path is also
If you find another similar entry, copy the all entries to the new folder. It’s something like this below.
If you can’t find it, add
InstallationFolder and give the path to AxImp.exe.