I am in the process of upgrading Phidget Nuget from 2024-09-11 to 2025-03-24 using latest VS 2022 (17.13.15).
If I use Nuget 2024-09-11 I get the usual 'dll' folder and subfolders in e.g. bin\Debug.
However, if I use 2025-03-24, 2025-01, 2024-12 release (possibly any releases in between 2024-09 and today) the dll folder does not get created in bin.
Obviously this causes issues when packaging the project.
The native library is now included in ./runtimes/<platform>-<arch>/native/
This is the correct way for native libraries to be packaged as of .NET 5. The old method of using the /dll/ folder was non-standard.
If you are targeting .NET 6+ your solution should package things properly automatically. If you are targeting .NET Framework you may need to do some manual work to make sure the native library is in the right location during packaging (although I would expect it to just work here as well).
Thanks Patrick, it's .NET Framework (net481) so I guess I need to copy native DLLs from the Nuget store.
Note that native dlls do not get included during build process into eg bin\Release folder which is unusual.
So if I copy native DLLs manually, where should they go then? In the root folder of exe, ie bin\Release where Phidegts22net.dll is or again create DLL subfolder and x86/64 sub folders? How would I swap between x86 and x64 DLL if app starts in x64 or x86 mode as they have the same file name?
I'm surprised to hear that. I made a new test project under VS 2022 and .NET Framework 4.8.1. Installed the phidget22 Nuget package, and it copied over the native libraries as expected. Maybe you need to reset something in your project? Try removing and re-adding the Phidget22 library?
I have in my output folder:
\bin\Release\Phidget22.NET.dll
\bin\Release\runtimes\win-x64\native\phidget22.dll
\bin\Release\runtimes\win-x86\native\phidget22.dll
Thanks Patrick - it all works now as expected - it seems it was a combination of VS glitch/needing-deep-reset-of-environment and me not realising that I should look for the runtimes folder in Release.