1

Using .Net 5.0 / Xamarin.Forms v5.0.0.2125

I re-opened a project I was building with .NET 5.0 in the past and have been trying to bring it back to life, everything works well with android but it doesn't work with iOS only because of the namespace resolution ( the using statements ) and I don't know what to do really since the intellisense isn't even helping. The photos of what is happening are at the bottom of the post.

I've updated the entire solution to the latest of every package and then the problem shifted from iOS to android saying xamarin.forms android project could not find 15 android x assemblies asking me to install 3 nuggets packages:

Xamarin.AndroidX.Legacy.Support.V4
Xamarin.AndroidX.Lifecycle.LiveData
Xamarin.AndroidX.Migration

which if I do says <whichever package I tried to install> does not support .netframework2.0 ( if doing it from the solution's nuggets )/does not support monoandroid11.0 ( if doing it from the android project's nuggets ).

So my thought was to stay with the "legacy" version of Xamarin.Forms since it was working without any problems in the past but right now I'm lost.

I also tried to increment the version of Xamarin.Forms little by little to see if it would resolve the usings at one point in the iOS project but that didn't work.

Now I don't really know if I should update everything and mess with the android project for which nothing works or not update and mess with the iOS project for which nothing works.

I also tried uninstalling and re-installing Xamarin.Forms from the Solution's packages, tried to dotnet restore, clean build, close VS 2022, open it and rebuild but nothing worked.

Either way, how can I make the iOS project resolve the using statements ?

AppDelegate.cs Image 1: AppDelegate.cs

A custom iOS file called CustomFrameRenderer.cs Image 2: a custom iOS file called CustomFrameRenderer.cs

using statements not resolving in another file

Image3: using statements not resolving

iOS project's nugget packages enter image description here

Android project's nugget packages enter image description here

Solution project's nugget packages enter image description here

3
  • (1) .netframework2.0 is ancient. Is your project targetting that, or is it some library (dll) or nuget that you include? Did it definitely say netframework, not netcore or netstandard? (2) Upgrade to XF 5. Or better, to Maui. Commented Apr 11 at 19:03
  • (For XF 5) "Build menu / Clean Solution". Quit VS. Copy your solution+project(s) to a new folder. Remove all nugets. Use XF 5. Start adding latest versions of nugets. Use AndroidX nugets, don't use any Android that doesn't say AndroidX. Commented Apr 11 at 19:06
  • (For Maui) Do above, then feed each project through Upgrade Assistant. I think you can do this, even for a project with build errors. -- whichever way you go, this will be non-trivial. But necessary. You won't be able to work with recent iOS versions at all, on anything less than XF 5. And you should plan on moving to Maui by end of year. It is possible that you would be better off starting with a new Maui project. Gradually adding your old code to it (after feeding through Upgrade Assistant). Commented Apr 11 at 19:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.