繁体   English   中英

Native C.dll on Windows referenced by .NET 6 App only works when Visual Studio with C++ Desktop Extension is installed

[英]Native C.dll on Windows referenced by .NET 6 App only works when Visual Studio with C++ Desktop Extension is installed

我使用开源库( https://github.com/libusb/hidapi )通过 USB 上的 HID 向我们的设备固件发送命令......更准确地说,我已经编译了 hidapi-Windows-project 的 C 代码和在我的 .NET 6 应用程序的 Wrapper-Class 中通过 DllImport-Attibute 调用其本机方法。 只要我在运行应用程序的同一台机器上安装了带有 C++ 桌面开发扩展 Package 的 Visual Studio 2022,一切正常...

将整个应用程序(自包含)发布到一个文件夹并在没有安装带有 C++ 桌面扩展包的 Visual Studio 2022 的机器上运行它,应用程序启动但 hidapi.dll-Wrapper 的 HidEnumerate 方法找不到任何 HID 设备...

所以我认为 C++ Redistributable 2022 可能丢失并安装了它,但不幸的是没有效果......

有谁知道缺少哪些 Dll 或配置?

是否需要签署应用程序以使其在没有 Visual Studio 上下文的情况下工作?

感谢评论中的提示...本机代码是使用调试配置构建的...在发布模式下构建后,本机库工作正常!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM