libplctag / libplctag.NET

A .NET wrapper for libplctag.
https://libplctag.github.io/
Mozilla Public License 2.0
214 stars 53 forks source link

Unable to load DLL plctag or one of its dependencies #370

Closed Primabase closed 3 months ago

Primabase commented 4 months ago

Hi,

I've added Nuget libplactag pack to a WPF application. The scope is read/write tags of an Omron NX plc. All run well from my client where the application was created. I've published for the distribution. In the destination client was displayed the error in the title. plctag.dll is created every time I run the application. I've read about the option "forceextractlibrary" but I don't know how to implement. S.O. are win 11 Pro 23H2 22631.3447 in my client, Win 10 22H2 19045.4291 in the destination client. Any suggestion?

timyhac commented 4 months ago

Not sure about your situation, but distributing a published WPF application has worked for me in the past - there may be additional information missing here. I see that you have had some success with this library in the past, what changed?

Have you tried this: https://github.com/libplctag/libplctag.NET?tab=readme-ov-file#developing-for-systems-with-immutable-application-directories

https://github.com/libplctag/libplctag.NET/blob/master/CONTRIBUTIONS.md#guidance-when-creating-an-issue

Primabase commented 4 months ago

I've tried to add a Project Reference to plctag.dll but it cause an error: the reference is invalid or unsupported. This happens with x86 and x64 version. The target framework is .NET 8.0

timyhac commented 4 months ago

plctag.dll is a native library, so the error you got in trying to add as a project reference is correct. Instead that library should be copied to the output directory.

timyhac commented 3 months ago

Hi @Primabase - I trust that the above support was able to resolve your issue!