Couldn't Add NuGet Package - xamarin

When I try to add the Plugin.FirebasePushNotification to my Xamarin.Android Project in Xamarin.Forms, I receive the following message, and the package isn't added. It seems to work fine on the iOS and Shared Projects, however. How would I fix this?
All packages and projects are compatible with MonoAndroid,Version=v11.0.
Package restore failed. Rolling back package changes
Message during Package Restore:
Version conflict detected for Xamarin.Android.Support.Collections. Install/reference Xamarin.Android.Support.Collections 28.0.0.3 directly to project Project.Android to resolve this issue.
Project.Android -> Project -> Plugin.FirebasePushNotification 3.3.10 -> Xamarin.Android.Support.v4 28.0.0.3 -> Xamarin.Android.Support.Media.Compat 28.0.0.3 -> Xamarin.Android.Support.VersionedParcelable 28.0.0.3 -> Xamarin.Android.Support.Collections (= 28.0.0.3)
Project.Android -> Project -> Xamarin.Auth 1.7.0 -> Xamarin.Android.Support.CustomTabs 28.0.0.1 -> Xamarin.Android.Support.Collections (= 28.0.0.1).
Restore failed.

Try clearing NuGet cache via command line:
nuget locals all -clear
To setup nuget you can check macOS/Linux section of NuGet CLI reference.

Solved the problem by manually editing the .csproj file to include the packages as instructed in the error.

I might be a bit late to this but the solution is always the same:
Go to nuget -> updates.
Update xamarin.essentials and xamarin.forms. (actually, FORMS FIRST!).
then comand line:
nuget locals all -clear
And then it will work again.

Related

The type 'xct:TabView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built

I'm getting the error of the tittle when trying to use XCT TabView.
I'm using Microsoft Visual Studio Community 2022. I installed XCT in my project by running both the commands in NuGet Package Manager Console:
Install-Package Xamarin.CommunityToolkit
Install-Package Xamarin.CommunityToolkit.Markup
In NuGet solution manager I selected both packages, I checked every checkbook responding to my projects and I hit "Install".
I get the following errors and warnings though:
Package restore failed. Rolling back package changes for 'MyProject'.
and
Error NU1605 Detected package downgrade: Xamarin.Forms from 5.0.0.2291 to 5.0.0.2196. Reference the package directly from the project to select a different version.
MyProject -> Xamarin.CommunityToolkit.Markup 2.0.0 -> Xamarin.Forms (>= 5.0.0.2291)
MyProject -> Xamarin.Forms (>= 5.0.0.2196)
I also added the relative namespace to XAML: xmlns:xct="http://xamarin.com/schemas/2020/toolkit
By the way, I get the same error too for xct:TabViewItem but I additionally get another error for it: Cannot resolve type "xct:TabViewItem"
Any ideas?
I had tried to do this and met the same problem as you.
This issue happened because the version of xamarin.forms is too low. So you can open the nuget package manager to update the xamarin.forms to the lastest version.
You can also download the earlier version of the Xamarin.CommunityToolkit and Xamarin.CommunityToolkit.Markup such as 1.3.1

The specified task executable location ......csc.exe is invalid error

I have a project on TFS that is working on everyone else's machine, except mine. When building I get the error that can be seen in the image. "The specified task executable location csc.exe is invalid." currently trying to repair VS 2017 now.
Based on the message, seems the csc.exe is damaged.
Just try below things to narrow down the issue:
Navigate to the Microsoft.Net.Compilers package location, delete
the package folder, then rebuild. Generally the package will be
restored automatically during the build.
YOUR_PROJECT_DIR\packages\Microsoft.Net.Compilers.2.6.1
Uninstall and Re-install the Microsoft.Net.Compilers package:
Open Visual Studio
Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution
Go to Installed tab and find Microsoft.Net.Compilers package
Uninstall the package from your project
Try to build your project now. (Thus it will use the default compiler which lives in the .NET framework folder:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe)
If you really need the Microsoft.Net.Compilers package then go ahead and find it in the Browse tab and install the latest stable
version.
Build the project and if everything works, make sure you commit changes to your code repository.
You can also try to run below command to uninstall and reinstall the
Nuget packages from the Package Manager Console: See Microsoft.Net.Compilers
Uninstall-Package Microsoft.Net.Compilers -Version 2.6.1
Install-Package Microsoft.Net.Compilers -Version 2.6.1
Remove Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers Nuget Packages.
Installing MSBuild 2015 will resolve the issue.
https://www.microsoft.com/en-us/download/confirmation.aspx?id=48159
I hit this question even though my error was "The specified task executable csc.exe could not be run" when pulling down existing web project with unit tests and trying to run it locally for the first time.
I was able to resolve this by building each project individually in my solution.

Failed to add MvvmCross 6.0.0

I am trying to upgrade MvvmCross from version 5.x.x to 6.0.0. My core project updated fine but having problems updating my Android project. I am getting the following error:
Summary of time taken to gather dependencies per source :
https://api.nuget.org/v3/index.json - 51.79 ms
Attempting to resolve dependencies for package 'MvvmCross.6.0.0' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'MvvmCross.6.0.0'
Resolved actions to install package 'MvvmCross.6.0.0'
Retrieving package 'MvvmCross 6.0.0' from 'nuget.org'.
For adding package 'MvvmCross.6.0.0' to project 'Listing.Mobile.Droid' that targets 'monoandroid81'.
For adding package 'MvvmCross.6.0.0' to project 'Listing.Mobile.Droid' that targets 'monoandroid81'.
Adding package 'MvvmCross.6.0.0' to folder 'C:\VSProjects\Listing\packages'
Added package 'MvvmCross.6.0.0' to folder 'C:\VSProjects\Listing\packages'
Added package 'MvvmCross.6.0.0' to folder 'C:\VSProjects\Listing\packages' from source 'https://api.nuget.org/v3/index.json'
Install failed. Rolling back...
Package 'MvvmCross.6.0.0' does not exist in project 'Listing.Mobile.Droid'
Executing nuget actions took 2.66 sec
Failed to add reference to 'MvvmCross'.
Reference unavailable.
Time Elapsed: 00:00:03.0575672
========== Finished ==========
I am not sure if this a NuGet problem, MvvmCross problem or something else. I have removed all references to MvvmCross 5.x.x to no avail. I have removed the contents of my packages folder and still nothing. Did anybody run into this issue?
I am using VS2017. I eliminated the problem by deleting. project.json.lock. It might have been a left-over from when I converted the project from VS2015 to VS2017 project setup. Once removed, I was able to add references for all require MvvmCross packages.
your project targeting .framework 4.5 , if you want use 6.0.0 you have to create cross-platform solution targeting .net standard 1.0 and above

Xamarin.Support.v7.RecyclerView

Hi I'm trying to install via nuget Xamarin.Support.V7.RecyclerView however I'm getting the following error :
"Could not install package 'Xamarin.Android.Support.v7.RecyclerView
25.1.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', 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. "
i think this it will help you.
try to update or download new version xamarin visual studio it will give you monoandroid v7 to be worked and set your Droid TargetFrameworkVersion to Android 7.0 or bigger.
Xamarin new version go www.https://www.xamarin.com/ -> login -> Profile -> Dashboard -> Download
try to update android sdk Android 7.1.1(API 25)
After all done install again Xamarin.Support.V7.RecyclerView, it will work

NuGet restore enabled but I still get an error

Why do I get the following build output error when I already have NuGet package restore enabled?
Restoring NuGet packages...
To prevent NuGet from downloading packages during build, open the
Visual Studio Options dialog, click on the Package Manager node and
uncheck 'Allow NuGet to download missing packages'.
All packages listed in packages.config are already installed.
MyProject.csproj: error : This project references NuGet package(s)
that are missing on this computer. Enable NuGet Package Restore to
download them.
It only happens on one project.
I am using Visual Studio 2013 and NuGet 2.8.
Make sure to upgrade to the latest version of NuGet which does package restore automatically. See this post by David Ebbo for more information: http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html
You're going to want to delete the NuGet targets (delete the .nuget folder and then manually edit your .csproj files and remove the lines that import the NuGet.targets file). This is no longer needed. When you compile your solution, NuGet will restore it.

Resources