首页 > 解决方案 > 构建错误:COMReference .NET CORE 3.0:未找到 AxImp

问题描述

我正在尝试编译具有 COM 引用的 .NET CORE 3.0 应用程序。不幸的是,在尝试构建具有引用的应用程序时,我收到了构建错误:

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2726,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\NETFXSDK\4.7.2\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.

与ide

我知道设置或配置可能有问题(?),但无法弄清楚到底是什么。我安装了 Visual Studio 2019(撰写本文时的最新版本,16.3.9)。该应用程序设置为目标 .NET CORE 3.0,它应该支持<ComReference ...>元素。

如何使用 Visual Studio 2019 构建具有 .NET CORE 3.0 的 COM REFERENCE 的应用程序?我正在从 VS2019 IDE 构建。据我了解,它甚至不应该寻找“AxImp”,它可能应该寻找“TlbImp”。另外,为什么要寻找 Visual Studio 2010?已安装 Windows SDK。它需要一些特定的版本吗?哪一个?

我尝试使用项目引用删除然后再次添加引用,没有任何改变。我错过了什么吗?

标签: .net-corereferencecomvisual-studio-2019.net-core-3.0

解决方案


安装 .NET SDK 4.7.2 后,问题就消失了。我之前有 4.8 版本(默认安装 VS 2019)


推荐阅读