How to fix Xamarin Forms blank project build error - xamarin

I have some error in new Xamarin blank project.
I tried:
Reopen VS
Update all Nuget package
Reinstall VS
The projet first build is failed with following errors:
Severity Code Description Project File Line Suppression State
Error Can not resolve reference: Xamarin.Android.Support.CustomTabs, referenced by Xamarin.Essentials. Please add a NuGet package or assembly reference for Xamarin.Android.Support.CustomTabs, or remove the reference to Xamarin.Essentials. TestAPP.Android
Severity Code Description Project File Line Suppression State
Error Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.DrawerLayout. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.DrawerLayout. TestAPP.Android
Severity Code Description Project File Line Suppression State
Error The “Xamarin.Android.Support.BuildTasks.VerifyVersionsTask” task could not be loaded from the assembly…nuget\packages\xamarin.android.support.annotations\28.0.0.1\build\monoandroid90\Xamarin.Android.Support.BuildTasks.dll. Could not load file or assembly ‘…nuget\packages\xamarin.android.support.annotations\28.0.0.1\build\monoandroid90\Xamarin.Android.Support.BuildTasks.dll’ or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. TestAPP.Android
Severity Code Description Project File Line Suppression State
Error Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.CoordinaterLayout. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.CoordinaterLayout. TestAPP.Android
Severity Code Description Project File Line Suppression State
Error Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.SlidingPaneLayout. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.SlidingPaneLayout. TestAPP.Android
Severity Code Description Project File Line Suppression State
Error Can not resolve reference: Xamarin.Android.Arch.Lifecycle.Common, referenced by Xamarin.Android.Arch.Lifecycle.LiveData.Core. Please add a NuGet package or assembly reference for Xamarin.Android.Arch.Lifecycle.Common, or remove the reference to Xamarin.Android.Arch.Lifecycle.LiveData.Core. TestAPP.Android
Severity Code Description Project File Line Suppression State
Error Can not resolve reference: Xamarin.Android.Arch.Core.Common, referenced by Xamarin.Android.Arch.Lifecycle.LiveData. Please add a NuGet package or assembly reference for Xamarin.Android.Arch.Core.Common, or remove the reference to Xamarin.Android.Arch.Lifecycle.LiveData. TestAPP.Android
Severity Code Description Project File Line Suppression State
Error Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.SwipeRefreshLayout. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.SwipeRefreshLayout. TestAPP.Android
Severity Code Description Project File Line Suppression State
Error Can not resolve reference: Xamarin.Android.Support.Compat, referenced by Xamarin.Android.Support.CustomView. Please add a NuGet package or assembly reference for Xamarin.Android.Support.Compat, or remove the reference to Xamarin.Android.Support.CustomView. TestAPP.Android
Severity Code Description Project File Line Suppression State
Error Can not resolve reference: Xamarin.Android.Support.v7.RecyclerView, referenced by Xamarin.Forms.Platform.Android. Please add a NuGet package or assembly reference for Xamarin.Android.Support.v7.RecyclerView, or remove the reference to Xamarin.Forms.Platform.Android. TestAPP.Android

Please try the following
Upgrade all Xamarin.Forms and Xamarin.Essentials nuget packages across all the projects in your Xamarin.Forms solution
Close Visual Studio
Go into your Android project's .csproj file and change the version number for all the Xamarin.Android support nuget packages (probably something like v27.x.x.x) to the latest, which is v28.0.0.1 (just do a replace all to update to that version)
Delete your bin and obj folders from each project folder
Reopen the solution in Visual Studio, do a clean and rebuild

Related

NuGet.Build.Tasks.GetReferenceNearestTargetFrameworkTask could not load Microsoft.Build.Utilities.v4.0

I'm starting to despair. I get the error below on every project I try to build.
Severity Code Description Project File Line Suppression State
Error The "NuGet.Build.Tasks.GetReferenceNearestTargetFrameworkTask" task could not be loaded from the assembly C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.Build.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
I have already tried any gacutil commands I have found the error and any other suggestions that have come up on google. Also, completely uninstalling via install clean-up from Visual Studio was unsuccessful.
Does anyone have any other ideas about what I could do?
Visual Studio 2022 version 17.4.4.
Thanks

While creating package for UWP with sideloading option getting error

I am trying to create package for UWP with sideloading option but getting following error...visual studio 2017
Severity Code Description Project File Line Suppression State
Error Manifest references file 'Assets\Icon\StoreLogo.png' which is not part of the payload. Versatilis.Shell.UWP E:\AppName.UWP\Package.appxmanifest 8
Severity Code Description Project File Line Suppression State
Error Manifest references file 'Assets\Icon\Square150x150Logo.png' which is not part of the payload. Versatilis.Shell.UWP E:\AppName.UWP\Package.appxmanifest 18

Can not resolve reference to "package" referenced by "project"

I am trying to run the Mobile project of ASP.NET Zero following their docs for Developing-Step-By-Step-Xamarin.
When I build the project, I get this error:
XA2002: Can not resolve reference: Abp.AutoMapper, referenced by Acme.PhoneBookDemo.Mobile.Shared. Please add a NuGet package or assembly reference for Abp.AutoMapper, or remove the reference to Acme.PhoneBookDemo.Mobile.Shared.
The package Abp.AutoMapper is installed in Acme.PhoneBookDemo.Mobile.Shared
and it is already referenced in the *.csproj:
<PackageReference Include="Abp.AutoMapper" Version="4.2.0" />
Can you please help me?
Solved , the package wasn't installed in *.Droid project but installed in *.Ios and *.Mobile.Shared projects.
Installing it in the *.Droid project resolve the issue.

Error with Xamari iOs cannot resolve reference

Severity Code Description Project File Line Suppression State
Error Can not resolve reference: /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Memory.dll Paga.iOS

Xamarin Forms with Visual Studio 2017

I am new to Xamarin and have created a cross-platform project in Visual Studio 2017.
When I build that project, I am getting the below issue:
Severity: Error
Code: MSB4062
Description: The "Xamarin.Forms.Build.Tasks.XamlGTask" task could not be loaded from the assembly C:\Users\E6430\.nuget\packages\xamarin.forms\3.1.0.637273\build\netstandard2.0\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Project: TestApp
File: C:\Users\E6430\.nuget\packages\xamarin.forms\3.1.0.637273\build\netstandard2.0\Xamarin.Forms.targets
Line: 84
My NuGet is also get coloured with yellow colour.
Try this:
Unload project from the solution
Restart visual studio and open solution
Reload project
Rebuild
If persist:
Just run Visual studio as Administrator!
Ref: https://forums.xamarin.com/discussion/106784/error-with-latest-nuget-v2-5-0-77-xamarin-forms-build-tasks-gettasksabi-task-could-not-be-loaded

Resources