Page 1 of 1

Bug in Phidget NuGet since Sep 2024?

Posted: Mon Apr 07, 2025 12:09 pm
by nm17
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.

It feels there is a bug in the nuget package.

Re: Bug in Phidget NuGet since Sep 2024?

Posted: Tue Apr 08, 2025 10:39 am
by Patrick
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).

-Patrick

Re: Bug in Phidget NuGet since Sep 2024?

Posted: Tue Apr 08, 2025 12:41 pm
by nm17
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?

Re: Bug in Phidget NuGet since Sep 2024?

Posted: Tue Apr 08, 2025 2:49 pm
by Patrick
Hi,

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

-Patrick

Re: Bug in Phidget NuGet since Sep 2024?

Posted: Wed Apr 09, 2025 8:55 am
by nm17
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.

Thank you