Home > Back-end >  Native C.dll on Windows referenced by .NET 6 App only works when Visual Studio with C Desktop Exte
Native C.dll on Windows referenced by .NET 6 App only works when Visual Studio with C Desktop Exte

Time:09-27

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. 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...

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...

So I thought the C Redistributable 2022 might be missing and installed it but unfortunately no effect...

Does anyone have an idea which Dll(s) or configuration are missing ?

Is it a matter of signing the application to make it work without the Visual Studio context ?

CodePudding user response:

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 !

  • Related