[英]Native C.dll on Windows referenced by .NET 6 App only works when Visual Studio with C++ Desktop Extension is installed
I use an OpenSource library ( https://github.com/libusb/hidapi ) to send commands to our device firmware via HID over USB...more precisely I´ve compiled the C-Code of the hidapi-Windows-project and call its native methods by DllImport-Attibute in a Wrapper-Class of my .NET 6 application.我使用开源库( https://github.com/libusb/hidapi )通过 USB 上的 HID 向我们的设备固件发送命令......更准确地说,我已经编译了 hidapi-Windows-project 的 C 代码和在我的 .NET 6 应用程序的 Wrapper-Class 中通过 DllImport-Attibute 调用其本机方法。 Everything works fine as long as I have a Visual Studio 2022 with C++ Desktop Development Extension Package installed on the same machine where the application runs...
只要我在运行应用程序的同一台机器上安装了带有 C++ 桌面开发扩展 Package 的 Visual Studio 2022,一切正常...
Publishing the whole application (self-contained) to a folder and running it on a machine where no Visual Studio 2022 with C++ Desktop Extension pack is installed the application starts but the HidEnumerate method of the hidapi.dll-Wrapper does not find any HID device...将整个应用程序(自包含)发布到一个文件夹并在没有安装带有 C++ 桌面扩展包的 Visual Studio 2022 的机器上运行它,应用程序启动但 hidapi.dll-Wrapper 的 HidEnumerate 方法找不到任何 HID 设备...
So I thought the C++ Redistributable 2022 might be missing and installed it but unfortunately no effect...所以我认为 C++ Redistributable 2022 可能丢失并安装了它,但不幸的是没有效果......
Does anyone have an idea which Dll(s) or configuration are missing?有谁知道缺少哪些 Dll 或配置?
Is it a matter of signing the application to make it work without the Visual Studio context?是否需要签署应用程序以使其在没有 Visual Studio 上下文的情况下工作?
Thanks for the hint in the comment...the native code was build with Debug-Configuration...after building it in Release-Mode the native lib works fine !感谢评论中的提示...本机代码是使用调试配置构建的...在发布模式下构建后,本机库工作正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.