Error com.opennetcf.extensions.pcl is not compatible with netstandard1.5 - xamarin.forms

I'm trying to understand the root of this error:
Package com.opennetcf.extensions.pcl is not compatible with netstandard1.5
I get it when I try to update xamarin essentials from nuget in my xamarin forms project. If I don't update that package, the project works fine. This is what I don't understand. If the PCL is not compatilble with .net standard 1.5, why does the project currently work when I'm using both. Why do I only see this error when I try to update xamarin essentials?
I've been reading a lot of articles on PCL support but I'm not sure what I need to do in this case. My main concern is updating xamarin essentials.
Any thoughts?

Related

Xamarin Android app out of the box shows undefined Android.Support, Android.Views, Android.Content in MainActivity

I needed to rebuild my fairly ancient Xamarin Forms app from scratch and in the process arrived at a situation where I had a new working iOS app but had needed to delete the draft Android app and start it again. So as a next step I added a vanilla Android app project out of the box and immediately what I saw was that (in MainActivity) Android.Support, Android.Views and Android.Content were undefined with wiggy red lines beneath -- for example in a reference to Android.Support.V7.Widget.Toolbar.
Trying to solve the problem, I set each of Target Framework, Minimum Android Version and Target Android Version to Android 9.0 Pie (API Level 28). In SDK Manager I checked that Android SDK Location and Java SDK Location were 'Found' and that Android SDK Platform 28 was installed.
The following NuGets came installed along with the project, I deleted them and reinstalled them (removing bin/obj folders in between): Xamarin.Android.Support.Core.Utils, Xamarin.Android.Support.CustomTabs and Xamarin.Android.Support.Design.
I tried installing NuGets Xamarin.Android.Support.v7.*. And I added the Xamarin.Forms NuGet. I tried adding 'use' declarations.
None of this helped.
For comparison I separately installed a blank Android app solution-- it worked perfectly out of the box.
Android is pretty new to me - would be grateful for suggestions on fixing this.
The app has a .NET Standard 2.0 project, an iOS project, the (vanilla) Android project (all three with Xamarin Forms), and a .NET Standard 2.0 library project.
I'm using Visual Studio for Mac V8.5.4 (stable) on MacOS 10.15.3.
I noticed that the content of MainActivity.cs is quite different, depending whether the Android project is created separately or as part of a Xamarin Forms solution. Also the provided NuGets are different. So perhaps what I was trying to do, adding an Android app to an existing XF solution, is simply not allowed.
To fix the problem, I created an empty Xamarin Forms solution with Android and iOS projects, added a further empty library project, then in Finder replaced the content of all the project folders, except the Android one, with the content of the corresponding folders in my working solution (the one with a working iOS app).
Migrating to AndroidX is a good idea though.
I don't know if this will help, but you should migrate to AndroidX as soon as possible, nevertheless. Xamarin has migrated to them, starting from Forms 4.5
Here is some more information about the libraries - Introducing AndroidX for Xamarin
There is a special NuGet package for the migration - Xamarin.AndroidX.Migration. Also available is a built-in functionality in Visual Studio - here
What I can suggest is you try to migrate to AndroidX libraries, since the old support libraries won't be supported from now on, and you will surely encounter some issues if not like this one, then something else will pop-up in the future.

Xamarin.Android Build Error for Xamarin Forms 4 Solution

I am trying to compile a newly created Xamarin.Forms solution using Visual Studio Pro 2019 version 16.1.3. I use the stable Xamarin.Forms version 4.0.0.425677. The solution contains an iOS, Android and UWP project.
When I try to compile I get the following Android compilation error even without having made any code changes.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3326,2): error : A part of the path "AccessibilityManagerCompat_AccessibilityStateChangeListenerImplementor.class" could not be found
The only related post I found was here which recommends to delete bin and obj folders in the Android project. This does not apply since I start with an new solution in the first place. Any ideas what the cause could be?
Well, it turns out that I only get this issue when I have the term "Xamarin" in my Android project name. This seems to confuse the Android compiler.

cannot run prism xamarin with Xamarin.Forms 3.5.0.62956-pre2 or 4.0 pre2

been trying to play with the new stuff that will soon coming out from xamarin form
I create a new Prism xamarin app
I upgrade the nuget packages to point to xamarin 3.5 or 4.0
but I cannot get the solution to run.
It just hangs!!
It works when I do the same thing with a standard xamarin form template
I know its just preview but I would like to know if somebody has tried to compile and run any app using prism xamarin and the preview xam forms.
many thanks
As far as I am aware there should not be any issues with Prism when targeting Xamarin Forms 3.5+.
That said if you're wanting to target one of the pre-releases I would suggest either installing the current preview on NuGet which targets 4.0-pre1, or the latest CI build which targets 3.5-pre2 and has a number of great new features including a more robust API for IContainerRegistry as well as support for Tuples in INavigationService.

ADAL 3.17.3 with Xamarin.Forms

i can't figure out how to create a project with Xamarin that use ADAL for authentication.
Visual Studio 2017
ADAL 3.17.3
Xamarin Shared Project or .NET standard, for me is the same, i even haven't understand what is needed for ADAL to work.
Latest updates in place.
Anyone got a good link for a tutorial or just any suggestion?
Pls note, iv'e tried something like 4, 5 tutorials, no one work. With shared project on android it says that can't load some part of the dlls, on .NET standard, the project won't compile at all.
All tutorials i've found were posted at least one year ago, when the ADAL was not just relaeased but on the preview channel.
Thank you guys!
I suggest that you have a look at this sample:
https://github.com/azure-samples/active-directory-dotnet-native-multitarget
If you are using a PCL library that consumes ADAL.NET be sure to also reference ADAL.NET in your Xamarin.Android project to be sure that the right DLL is picked-as the NuGet package supports several platforms as explained here

.net standard library with HttpCient for xamarin forms

I was trying to create a common library for using HttpClient to consume an API. I was planning to make it in .net standard so as to share it with my xamarin.forms project right now and any future ones. However the highest version of .net standard I managed to use was 1.0. HttpClient needs standard2.0. I have included the latest version of .netstandard nuget into my xamarin.forms.
I have noticed that xamarin.forms runs in net4.5. According to the documentations the max I can go with this is standard1.1. Is there any work around around these to a .net standard common project or is my only option to make a .net framework project/xamarin portable library?
I used to be in the same situation and I managed to pull through this. First I tried to upgrade my current PCL project to .netStandard, but it was always failing, so I decided to create a new Project A Class Library (.NETStandard), moved all my files to the new project and re-install all nuget packages.
New project configuration:
Target Framwork: .NET Standard 2.0
Output type: Class Library
Make sure you're using Microsoft Visual Studio > version 15.3
Hope it helps.
I did manage to get HttpClient working in .net standard after manually importing the class. It needed an additional reference which is why it threw an error when I downgraded from .netcore.
This seems to work sometimes and throws reference errors other times. These errors go when I close and re-open visual studios.

Resources