NuGet Packages Version conflics - xamarin.forms

I'm coming to ask a question, maybe stupid, but I can't find a good explanation about it..
For this example, I'll take for example a Xamarin Forms - Portable Project and look at the Project.Droid part. Also, I'm gonna take the following packages:
Xamarin.Forms.Map 2.3.1.114
and
Xamarin.Android.Support.Vector.Drawable 23.3.0
Xamarin.Android.Support.v7.RecyclerView 23.3.0
Xamarin.Android.Support.v7.MediaRouter 23.3.0
Xamarin.Android.Support.v7.CardView 23.3.0
Xamarin.Android.Support.v7.AppCompat 23.3.0
Xamarin.Android.Support.v4 23.3.0
Xamarin.Android.Support.Design 23.3.0
Xamarin.Android.Support.Animated.Vector.Drawable 23.3.0
As you can see, the Xamarin.Forms.Map package is version 2.3.1.114 and the others, 23.3.0. However, an update is available, but when I make it, the package of 23.3.0 version update to 23.4.0.1 while Xamarin.Forms.Map is downgrading to 1.5.1.6471 ...
Why does it work like it? why everything doesn't up to the last update? What are the differents effects of this update/downgrade? Also, what's the best choice? Does it's better to update the Xamarin.Android.Support.xxx packages and downgrade the Xamarin.Forms.Map one or do the reverse?
Thank in advance for your answer/explanation :)

Some package are update and not compatible with the last version of Xamarin.form, because the updates are not at the same frequency the principal reason, are all the new versions of Xamarin.form need to be probe, and be stable and may be exist a delay between one and other.
for Example if you try to install Xamarin.Android.Support.Design
Attempting to resolve dependencies for package 'Xamarin.Android.Support.Design.23.4.0.1' with DependencyBehavior 'Lowest'
One or more unresolved package dependency constraints detected in the existing packages.config file. All dependency constraints must be resolved to add or update packages. If these packages are being updated this message may be ignored, if not the following error(s) may be blocking the current package operation: 'Xamarin.Android.Support.Design 23.3.0'
Unable to resolve dependencies. 'Xamarin.Android.Support.Design 23.4.0.1' is not compatible with 'Xamarin.Forms 2.3.1.114 constraint: Xamarin.Android.Support.Design (= 23.3.0)'.
'Xamarin.Android.Support.Design 23.4.0.1' is not compatible with 'Xamarin.Forms 2.3.1.114 constraint: Xamarin.Android.Support.Design (= 23.3.0)'.
Xamarin Form 2.3.1.114 say I'm compatible with the version = 23.3.0
Regards.

The nuget manager allowing you to update packages to the version compatible with target SDK version selected in the project properties. If you need to upgrade to the newer version you have to install newer version of android SDK and update it in project properties to be able to upgrade nuget packages.

Related

Xamarin.Firebase.Database Compatibility Issue

I have created a Xamarin Andoid project (Not a Xamarin Forms project) using Visual Studio 2019 and it is working fine (No any code changes done). By default it has these Nuget packages installed:
I tried to install Xamarin.Firebase.Database latest version (71.1601.0) and got this error.
Then I tried to install the previous version (60.1142.1) and it got installed. But When I try to build the project I got this error.
I am unable to run the project so how can I resolve this issue?
If you just install the Xamarin.Android.Support.v4 28.0.0.3, you still cannot install Xamarin.Firebase.Database (71.1601.0), you should install following nuget packages.
Xamarin.Android.Support.Compat (>= 28.0.0.3)
Xamarin.Android.Support.Core.UI (= 28.0.0.3)
Xamarin.Android.Support.Fragment (= 28.0.0.3)
Xamarin.Android.Support.Annotations (= 28.0.0.3)
Xamarin.Android.Support.VersionedParcelable (= 28.0.0.3)
I installed Xamarin.Firebase.Database latest version (71.1601.0) successfully, Here is my screenshot.
i got same error a week ago. Remove adroid native nuget packages all from your adroid part. Then install your package. if you need, then install your android packages.
I had one packages installed named "android.support.*****". Searched but couldnt find solution easily. Compiler suggests that installing so many packages. I removed the one android package then i could installed the xamarin packages.
I had a similar error and solved it as follows. My error was an Xamarin.Firebase.Common (71.1610.0) installation error. Error disappeared after installing Xamarin.Android.Support.v4 "(28.0.0.3). Hope it helps
Xamarin.Essentials has a dependency on Xamarin.Android.Support.v4 28.0.0.3 while Xamarin.Firebase.Database has a dependency on Xamarin.Android.Support v4 28.0.0.1. The error message is telling you to directly add a reference to Xamarin.Android.Support.v4 28.0.0.3. That should fix the problem for you.

Upgrading Newtonsoft.Json from 10.0.3 to 11.0.1

I have just used the NuGet Package Manager to see what updates are available and it informed be about 10.0.3 - 11.0.1:
I understand that a main version number change can be code breaking. How can I ascertain the issues I will have if I upgrade the package? I could not see any information.
I see similar questions but they were for version 6x.

Xamarin.Forms downgrade package issue

I'm using Xamarin.Forms. I updated all Xamarin.Android.Support package in my VS project. So when I realize updating Xamarin.Android.Support package in Xamarin.Forms is a mistake, I remove all package and install Xamarin.Forms last version and let it to install the dependencies in other word downgrade the dependencies to 23.3.0 version. So now, when I clean and rebuild my solution I get this error.
This project references NuGet package(s) that are missing on this
computer. Use NuGet Package Restore to download them. For more
information, see http://go.microsoft.com/fwlink/?LinkID=322105. The
missing file is
....\packages\Xamarin.Android.Support.Compat.25.4.0.2\build\MonoAndroid70\Xamarin.Android.Support.Compat.targets.
I think we should not install this package manually. Xamarin.Forms should take care of the dependencies. All dependencies is in 23.3.0 version and it is clear that no need to install Xamarin.Android.Support.Compat.25.4.0.2 manually.
So what should I do to solve this issue?
Xamarin.Forms locks in a very specific version of the support libraries and google play services. You can't update them because Xamarin.Forms isn't compatible with them as it would need to be re-compiled.
Xamarin.Android.Support.v4 (= 23.0.1.3)
Xamarin.Android.Support.Design (= 23.0.1.3)
Xamarin.Android.Support.v7.AppCompat (= 23.0.1.3)
Xamarin.Android.Support.v7.CardView (= 23.0.1.3)
Xamarin.Android.Support.v7.MediaRouter (= 23.0.1.3)
See the = 23.0.1.3, which means it is only compatible with that version number. This is just how NuGet works. When Xamarin.Forms updates these packages will auto update.
When you want to update Xamarin.Forms ONLY update Xamarin.Forms, don't update all of the packages. When you update just Xamarin.Forms it will update it's dependencies to the correct version number needed.
If you already update the other nugets that aren't letting you update, you could simply uninstall your packages and re-install just Xamarin.Forms.
Here is a video: http://screencast.com/t/U5FBj6KlH
The issue was solved. The package CarouselView.FormsPlugin new version (4.4.3) has dependency to Xamarin.Android.Support.v4 version 24.2.1 (Android 7).
Downgrade to version 4.4.2 fixed the issue.

Could not install package 'Splat 2.0.0'

Trying to install Splat 2.0.0 into Xamarin Forms project results with error:
Could not install package 'Splat 2.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
How to resolve this issue please?
Thanks,
AG
I found this on the GitHub of your tool:
Please use Splat 1.6.2 when targeting PCL projects. v2.0 and onwards is netstandard only. There will be no updates to the 1.6.x series so if you need to patch the release then please fork and maintain your own copy/build from source.
It seems they stopped supporting PCL. So as a solution I suggest using Splat 1.6.2 as that seems to support ¨PCL. Good luck

Install a Nuget package ignoring ONE dependency

I'm sure this has been asked before, but I spent almost an hour searchin Stackoverflow and haven't found any answer. Sorry if I missed it.
I need to install a Nuget package without one (just one) of its dependencies.
In particular, I'm adding SignalR to an ASP.NET MVC app and I need to skip jQuery-dependency because I already have it added manually, from a CDN-hosting. Don't need it in my project.
But I need all the other dependencies, and I need them managed by Nuget, not manually. So if the author adds some new dependency to the next version, - like Owin or something, - it will be pulled in automatically.
The only solution I came up with is to install the package with all the dependencies and then run
Uninstall-Package jQuery -Force
Is this ok? It seems a bit "hacky" to me, or is it fine? Are there any other options?
I need to install a Nuget package without one (just one) of its
dependencies.
Not possible currently through Command Line, because Install-Package doesn't have any parameter to skip a particular dependency (as visible in the latest microsoft docs reference).
Use the below command if you want to avoid all of the Dependencies (as you can't skip a particular dependency because it is nowhere quoted in Microsoft Docs):
Install-Package Microsoft.AspNet.SignalR -IgnoreDependencies
Detail about the parameter from Install-Package document from Microsoft:
Install-Package [-Id] <string> [-Version <string>] [-IgnoreDependencies]
[-ProjectName <string>] [-Source <string>] [-IncludePrerelease] [-FileConflictAction]
[-DependencyVersion <dependencyVersion>] [-WhatIf]
IgnoreDependencies : Installs only this package and not its dependencies
Is this ok? It seems a bit "hacky" to me, or is it fine? Are there any other options?
The simple answer is "It depends on the version of jQuery-dependency which you have added manually ".
You will notice that the dependency restrictions of Microsoft.AspNet.SignalR is: jQuery (>= 1.6.4):
So if the version of jQuery which you have installed manually is higher than the version of dependency restrictions of Microsoft.AspNet.SignalR, you can uninstall the jQuery, then install the package Microsoft.AspNet.SignalR. Therefore, your method is feasible.
Note: After install the package Microsoft.AspNet.SignalR, you can update the version of the package jQuery, if you want.
In contrast, the version of jQuery which you have installed manually is lower than 1.6.4 and you do not want to use the high version of that package, you can not do it with your method, otherwise, NuGet will install the jQuery with version 1.6.4 after install the package Microsoft.AspNet.SignalR.
What I ended up doing is install jQuery nuget package and then simply remove files from the /Scripts directory
Now all the jQuery-dependent packages are happy and my project is not bloated with unneeded files

Resources