Error MT2002: Failed to resolve assembly: Microsoft.WindowsAzure.MobileServices.iOS - azure

I have updated my xamarin.ios project to IOS14 SDK and i am getting the following build error
Error MT2002: Failed to resolve assembly: 'Microsoft.WindowsAzure.MobileServices.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' (MT2002)
I understand that the Azure Mobile Services Library is deprecated, however is there a way that i can build my project without migrating to Azure Mobile Apps?
#September 2021 Update
With Xamarin.iOS 14.20.0.24 i continue to have the error

Related

Azure Notification Hub Client run time error

Downloaded latest Microsoft.Azure.NotificationHubs NuGet package used the NotificationHubClient to create an installation this.HubClient.CreateOrUpdateInstallation(installation);
All the default dependent packages were used when adding the NuGet. When testing I am receiving the following error:
Could not load file or assembly 'Microsoft.Extensions.Options, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I assume this is widely used. How do I get past this?
This is version conflict issue. Remove all your old version package and reinstall Microsoft.Extensions.Options, it will work 👍

Why my entity framework dll is not loaded?

I'm deploying an application on a production server (so no visual studio installed locally).
I have a EntityFramework.dll in my bin folder.
But I keep getting a 500 error.
Cannot load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of his dependencies
The nuget page says it has no dependency.
I have .net framework 3.5 and 4.7
Any idea on what to look for ?

Azure DevOps build of Xamarin.iOS project fails - MTOUCH : error MT2002: Failed to resolve "System.Drawing.Color" reference

I have a build issue with a Xamarin.iOS app in Azure DevOps that I haven't been able to solve. I'm wondering if anyone has any suggestions.
Building the iOS version of the app works locally in VS for Mac but fails in Azure due to this error:
MTOUCH : error MT2002: Failed to resolve "System.Drawing.Color" reference from "System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [/Users/runner/runners/2.164.6/work/1/s/iOS/CatRentalStore.iOS.csproj]
I was having a similar issue with the Android build. I resolved it by switching from the macOS-10.14 hosted build agent to the windows-2019 agent, but that isn't an option with the iOS app.
I've updated packages that may use System.Drawing.Color to the latest stable releases - Acr.UserDialogs, BTProgressHUD, Splat, and Xamarin.Essentials.
I searched the solution source and did not find any direct references to the System.Drawing.Color class.
I also tried specifying the version of Xamarin/Mono to use in the build to match my local version using sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_4_0. That caused a different error to occur:
error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
error MSB4018: System.MissingMethodException: Method not found: System.Collections.Generic.IList`1<NuGet.Packaging.Core.PackageDependency> NuGet.ProjectModel.LockFileTargetLibrary.get_Dependencies()
References to this issue:
https://github.com/mono/mono/issues/13483
https://github.com/xamarin/xamarin-macios/pull/6011
https://github.com/aritchie/userdialogs/issues/654
https://github.com/reactiveui/splat/issues/204
According to this document:
NET Core 2.2.105 is default on VM images but Mono version 6.0 or greater requires .NET Core 2.2.300+. If you use the Mono 6.0 or greater, you will have to override .NET Core version using .NET Core Tool Installer task. If you use 6.4.0, you need to install at least 2.2.300+ .net core.
I had the same problem. Visual Studio sometimes failed to update the reference during the NuGet package upgrade:
These steps helped me resolve my issue (iOS project):
Check every reference and see if it matches the version of the corresponding NuGet package
Check the path/version of the referenced assembly:
Make sure that it matches your installed package version:
If the versions do not match: downgrade the corresponding NuGet package and then upgrade the same NuGet package again and check if the version now matches
I did that procedure one NuGet package at a time. After ensuring that all versions match the build succeeded.
On my dev machine, the older versions were still present in the packages folder. Therefore the build always worked on my machine but not on the build server.

Upgraded ServiceStack.OrmLite.SqlServer. Getting an error about System.Text.Encoding.CodePages now

I inherited a project that was written in .NetCore 2.0 initially. The version of ServiceStack.OrmLite.SqlServer.Core that we were using was 1.0.43. I upgraded everything in NuGet, so ServiceStack is now 5.4.0.
The problem now is that when I try to run my code:
var dbFactory = new OrmLiteConnectionFactory(dbConnection.ConnectionString, SqlServerDialect.Provider);
using (var db = dbFactory.Open())
I get an error
System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Text.Encoding.CodePages, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I see in the drilldown for the dependencies that ServiceStack is referencing version 4.5 of the Code Pages.
I'm unsure of what I need to do to fix this...
If it's a .NET Core project then it should not be using any *.Core packages which after v5, are only meant for running ASP.NET Core Apps on the .NET Framework.
Since v5, the main packages, e.g: ServiceStack.OrmLite.SqlServer contain both .NET Standard 2.0 and .NET 4.5 Framework builds.
Given it's referencing the wrong packages I would uninstall all ServiceStack packages and only install the non .Core ServiceStack packages.

How to fix Newtonsoft.Json assembly loading error?

I'm attempting to load a pre-existing Umbraco CMS site into a Visual Studio project and am caught up in a bit of DLL hell.
Here is the error message I get when attempting to compile the site:
Could not load types from assembly Umbraco.Core, Version=1.0.5462.37503, Culture=neutral, PublicKeyToken=null, errors:
Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
I've attempted to re-install Newtonsoft from NuGet, re-install Umbraco from NuGet, delete all DLLs and re-install, removed the Newtonsoft dependentAssembly, every possible solution I've been able to find and this error continues to come up.
Any suggestions?
I'm guessing the binding redirect isn't set up correctly in the web.config file. Try running this in the nuget package manager console:
PM> Get-Project –All | Add-BindingRedirect
This ended up being a bit of a misunderstanding on my part from following the Umbraco videos. I was attempting to set up a new Visual Studio project, import all the DLLs needed, and then move the site content into the project.
All I really needed to do was create a blank project, then move the site content, with all of its DLLs, into the project. This let me immediately start editing the project.
The best solution was to install an earlier version of the package and then upgrade.

Resources