.NET Standard 1.4 Class Library in UWP app - c#

I'm exploring the idea of using this product in a UWP app, and one approach I'm starting to look at is to port the available C# .NET wrapper the manufacturer made available on their website to a Class Library using .NET Standard 1.4.
https://www.usdigital.com/products/interfaces/pc/usb/USB4
I believe I've got it close where I can reference the library in my UWP app and it runs, but I keep running into issues like the one below. I've tried referencing NuGet packages for System.Threading.ThreadPool (v4.3.0) and NETStandard.Library (v1.6.1), but it doesn't work. I have verified that the ported class library still works for an existing .NET desktop app we've used it on.
Could not load file or assembly 'System.Threading.ThreadPool,
Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
The system cannot find the file specified.
Edit1:
I've removed portions of code that reference System.Threading and it seems that was the least of my problems. UWP app now runs, however it's unable to read from the device. Verified it still works on the old .NET desktop app with the modification.
The class library has a bunch of [DllImport("USB4.dll")]. Is that not supported in .NET Standard 1.4?

Related

Build Pjsip windows sdk/.net 6 target dll

I am trying to create a pjsip dll and add it to an Uwp app. I have built a dll following this (working fine for WPF). Which gives an error while adding dll to the Uwp project saying unsupported-frameworks don't match as uwp targets Windows SDK. Creating a .net standard 2.0 class library as a bridge also didn't work.
At first, I found this solution. But this also produces more errors.
Now, I want to create a dll for Pjsip and use it in my UWP app. I am badly in need of a solution for creating windows SDK using pjsip or a suggestion regarding workarounds to use the current win32 .net framework targetted dll in the uwp project.
I have build pjsua2 dll and working fine using this link

Could not load file System.Drawing.Common but it is not part of my references

Since English is not my native language I'm gonna try to explain myself as clearly as possible.
I have an old project on Visual Basic targeting the .NET Framework version 4.5.2, the project has a reference to System.Drawing dll but no System.Drawing.Common dll reference, when executing the application on my development PC it works fine.
My problem is that when I execute it in a virtual machine that I'm starting to use by requirement of my boss that had no .NET installed, the application cannot found a reference to System.Drawing.Common dll; I already have installed on the virtual machine:
.NET Compact Framework 2.0 (Since my boss told me that it could be some even older dlls)
.NET Compact Framework 3.5 (Since it went with the 2.0 version)
Windows Desktop Runtime 3.0.3 (Cause I found some links that said the dll is part of .NET Core)
Windows Desktop Runtime 3.1.3 (Just in case)
And trying to install any of the .NET 4.x versions tells me that its already installed cause the OS is Windows 10.
Since that seemed not to work I also put a copy of System.Drawing.Common.dll directly in the executable directory and modified the project to load it when the AssemblyResolve event fires. But it still not working, and also I canĀ“t understand why is it requesting that assembly if none of my dlls and exe reference to it.
I'm trying to keep the virtual machine with no developer tools so i'm not sure what else to do. Would be pretty grateful if anyone has some clue of what my problem is. Thank you.
Edit: what makes more noise in my mind is: If System.Drawing.Common is a dll of .NET, shouldn't it be automatically loaded to any .NET application when it is needed? or at least be recovered since I already put the dll in the same folder as the .exe file of my application

How to System.Data.SQLite Interop.dll on Xamarin.Forms?

I get the following problem every time I try to run my mobile application:
System.DllNotFoundException:
'SQLite.Interop.dll assembly:<unknown assembly> type:<unknown type> member:(null)'
To put this in some context:
I am developing on Xamarin.Forms [4.3.0] (in this case running the build on Android 9.0 x86). The client-side library runs on .NET Standard 2.0 and I have installed System.Data.SQLite.Core (1.0.112) from NuGet.
When you look up my problem, you will find people saying to put the SQLite.Interop.dll's into the x86/x64 folders. But when looking for these files there are none for .NET Standard at all, only for .NET Framework. I tried using the SQLite.Interop.dll's from the precompiled statically-linked binaries from the .NET Framework 4.6 version.
Screenshot of the project structure
Same error though.
Unfortunately, it is not possible for me to switch the SQLite library as I am porting a desktop version to mobile which uses this lib.
if they have not made a mess in the classes and functions you need to port you can use "Microsoft.Data.SQLite", there is a difference but is not as far away from usable as the crazy nonsense you need to do with "SQLite-Net-Pcl"

Using software (.dll) written in .Net Framework 2.0 for UWP Apps

I am developing a UWP App and want to use some libraries which are developed in .Net Framework 2.0 (Subsembly FinTS API)
When I include them into my UWP projekt and try to build the app i get the following errors:
Cannot resolve Assembly or Windows Metadata file
System.Windows.Forms.dll
Type universe cannot resolve assembly: System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
So my qestion ist: Are .Net Framework 2.0 and .Net Core (UWP) compatible? Or is there a way to make them compatible?
Unfortunately you can't use full .NET Framework libraries in UWP apps directly.
The only way to make it work is using so-called Brokered Windows Runtime Components. This technique works only with side-loaded apps on desktop (you can't publish the app on the Windows Store) and requires a proxy component that will allow communication between the Windows Store app and the full CLR server component.
The server class library can reference the System.Windows.Forms.dll and the proxy component provides Windows Runtime-safe access to invoke the code inside the server library. That means you can actually show a Windows Forms MessageBox from UWP for example.
You can learn more about this here on MSDN along with the full documentation on how to achieve this.

How to build ServiceStack to use it with MonoDroid?

I'm trying to use ServiceStack REST DTO and OrmLite with monoDroid.
But I can't fugure out how to build ServiceStack to use it.
By default I have error while deploing to mobile device:
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(464,2): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
The problem here was that you were trying to use a ServiceStack DLL compiled against the full .NET profile from your Mono for Android application, which is destined to fail. In this particular case, it was failing because that DLL had a dependency on System.Configuration, which is not included in the Mono for Android profile. In order to use a library with your application, you should compile its source against the Mono for Android profile, which will verify that the profile supports it, and allow you to safely reference it from your application.
When trying to compile a Mono for Android version of an existing library, the easiest place to start is with the Silverlight build for it (if there is one). Since the Base Class Library exposed by Silverlight is very similar to that of Mono for Android, the set of files/compilation symbols generally lines up between them as well. I have an old post up here that talks about how to link files in from other projects in order to properly compile a class library.

Categories

Resources