Nuget packaging - can't find dll?
Posted: Sun Feb 28, 2021 2:13 pm
I have started using Nuget version of Phidgets drivers in my c# WPF application. The app is packaged using VS Installer Projects and then installed usually as an upgrade to previous app version.
The installer project correctly detects Phidget nuget dlls and does put them in the application folder (ie c:\program data...\my app\). However when I start the application I get a binding error from windows (this is a call to enable hardware logging in Phidgets). Basically it states it can't find the DLL which is weird as the DLL is in the folder. I use other (non-Phidget) Nuget packages in the same project and that all works well.
I thought that there may be a clash as I had Phidget Control Panel installed so I uninstalled that - but no luck.
What I found resolves the issue is: uninstall both Phidget CP and my app, then install my app, then install Phidget CP (must match version to nuget package!) and then it works.
I am wondering if I am missing a trick here, I have to confess I am not a Nuget guru and as I don't have problems with other packages thought it may be something Phidgets specific...
Do I need to do something specific eg ask Installer Project to register Phidgets as COM module or anything else to make Nuget work with or without Phidget CP. Ideally I would like my software to work without having Phidgets CP on the device but if CP is installed then it should not break/clash with whatever nuget-Phidgets dll is installed.
I have used dll dependency walker and it appears that Phidget22.Net.dll is referenced correctly *but* this dll itself references system-wide Phidgets dll which I guess requires Phidgets CP (matching version) to be installed??
The installer project correctly detects Phidget nuget dlls and does put them in the application folder (ie c:\program data...\my app\). However when I start the application I get a binding error from windows (this is a call to enable hardware logging in Phidgets). Basically it states it can't find the DLL which is weird as the DLL is in the folder. I use other (non-Phidget) Nuget packages in the same project and that all works well.
I thought that there may be a clash as I had Phidget Control Panel installed so I uninstalled that - but no luck.
What I found resolves the issue is: uninstall both Phidget CP and my app, then install my app, then install Phidget CP (must match version to nuget package!) and then it works.
I am wondering if I am missing a trick here, I have to confess I am not a Nuget guru and as I don't have problems with other packages thought it may be something Phidgets specific...
Do I need to do something specific eg ask Installer Project to register Phidgets as COM module or anything else to make Nuget work with or without Phidget CP. Ideally I would like my software to work without having Phidgets CP on the device but if CP is installed then it should not break/clash with whatever nuget-Phidgets dll is installed.
Code: Select all
Exception: System.DllNotFoundException: Unable to load DLL 'phidget22': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Phidget22.Phidget22Imports.PhidgetLog_enable(LogLevel level, IntPtr destination)
at Phidget22.Log.Enable(LogLevel level, String destination)
at S.SC.HardwareLog.EnableHardwareLogging(Boolean enable, String logName)
at Phidget22.Phidget22Imports.PhidgetLog_enable(LogLevel level, IntPtr destination)
at Phidget22.Log.Enable(LogLevel level, String destination)
at S.SC.HardwareLog.EnableHardwareLogging(Boolean enable, String logName)