简体   繁体   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

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.

相关问题 除非安装了visual studio,否则无法使用C ++ / CLI DLL - Cannot use a C++/CLI DLL unless visual studio is installed 如何从 Visual Studio.NET 或 Visual Studio 2005 中的本机 Visual C++ 代码调用托管 DLL - How to call a managed DLL from native Visual C++ code in Visual Studio.NET or in Visual Studio 2005 使用Visual Studio 2017构建的.NET 4.7.2 C#控制台应用程序的ILRepack需要在Windows 7上安装框架 - ILRepack of .NET 4.7.2 C# console app built with Visual Studio 2017 requires framework installed on Windows 7 通过C ++ / CLI包装器将本地C ++ dll与C#连接起来,Visual Studio问题 - Connecting native C++ dll with C# by C++/CLI wrapper, Visual Studio issue 无法将Visual Studio制作的C ++ DLL导入Windows上的Visual Studio C#项目 - Unable to Import a Visual Studio made C++ DLL into a Visual Studio C# Project on Windows 如何使用您在Visual Studio C#.Net中引用的项目的dll? - How to use dll of the project you referenced in Visual Studio C# .Net? 在Visual Studio 2010中将本机/ C ++ DLL链接到托管C ++ / CLI包装器 - Linking Native/C++ DLL to Managed C++/CLI Wrapper in Visual Studio 2010 如何在C#中从C.dll封送字节* - How to marshall byte* from C.dll in C# 在Visual Studio C ++中使用DLL - Using a DLL in Visual Studio C++ 使用Visual Studio 2013将C / C ++ DLL生成并交付到C#应用程序中 - Build and deliver a C/C++ DLL into a C# app using Visual Studio 2013
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM