missing win-iphone identifier error while building Xamarin iOS after updating VS for Mac to 17.4.5 - xamarin.ios

Has any one seen this issue?
My dotnet runtimes are as follows:
Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
This is the exact error:
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Microsoft/NuGet/Microsoft.NuGet.targets(5,5): Error: Your project file doesn't list 'win-iphone' as a "RuntimeIdentifier". You should add 'win-iphone' to the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore. (ProjectName.iOS)
Interesting thing is, it was not happening until VS for mac was updated.
I'm going to try running the code on an older mac. The current mac is an Arm machine, if that helps.
I did some looking, but everyone's experience is different with this error.

Related

Can't install Orc.Controls in a .Net Framework 4.7 project

When I try to add the Orc.Controls package v4.2.8 from Nuget I get the error "You are trying to install this package into a project that targets '.NETFramework,Version=v4.7', but the package does not contain any assembly references or content files that are compatible with that framework." The documentation page https://opensource.wildgums.com/ says that .NET 4.7 is supported. Am I doing something wrong, or does the pacakge just not support .NET 4.7?
According to nuget, 4.1.1 was the last version to support .Net Framework 4.7, you can install that version with: Install-Package Orc.Controls -Version 4.1.1
The current version is >= .NET Core 3.1.

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.

Cannot install Microsoft.Azure.ServiceBus using NuGet

I'm running a test .Net Core Console app to try using ServiceBus messages. However after using Nuget to install Microsoft.Azure.ServiceBus v3.1.1 I get the following error
Package Microsoft.Azure.ServiceBus 3.1.1 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.Azure.ServiceBus 3.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
I've tried installing up to v3.3.0 and get the same, I'm using the latest .Net framework and have updated my VS2017 so I don't know what the problem can be. Has anyone else had this issue?
I don't know what the problem can be
No matter the version of package Microsoft.Azure.ServiceBus is v3.1.1 or v3.3.0, both of their Dependencies is .NETStandard 2.0 while your app is .NetStandard 1.0. So, as Peter said, the version of .net core you have is too old.
You could go to download the latest .Net Core SDK and then reinstall the package you want.
Or you could download the Microsoft.Azure.ServiceBus v1.0.0. However, because the version is too old, some feature may not have. So, I suggest that you could update your TargetFramework to .net core 2.0+.
Your console app needs to have a TargetFramework .net core 2.0+ (Check in .csproj file), download latest .NET Core SDK and create a new .Net core console app to install the package again.

Can't install M2MQTT Nuget package to Xamarin.iOS

When installing the Nuget package for M2MQTT 4.3 to my Xamarin.iOS project, I get the following error:
Could not install package 'M2Mqtt 4.3.0'. You are trying to install
this package into a project that targets 'Xamarin.iOS,Version=v1.0',
but the package does not contain any assembly references or content
files that are compatible with that framework.
However, 4.2 works fine. I have seen this error pop up for some other packages too, and my Nuget is up to date. This error shows up when I try to install in VS2017 on Windows and also on Visual Studio for Mac.
Should it be possible to build the package myself from source, and if so, what do I need to change to make it compatible (assuming that the library doesn't actually use part of .NET that Xamarin.iOS doesn't support)?
The reason I need to update is that on 4.2 I get the following error when trying to create a MqttClient:
The type 'IPAddress' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System, Version=3.9.0.0...'
and my hope is that this error will be resolved in the newest version.

Add Tweetinvi to mono without nuget

I had to make a .NET project in Linux using monodevelop. When I tried monodevelop in Ubuntu I got an error message when I used nuget at certain packages saying my version is 2.8 and I needed 2.12 or earlier.I updated nuget package successfully in terminal but monodevelop uses 2.8 no matter what I do. The nuget package I can't use because of this is Tweetinvi.
In order to solve this I have to either add tweetinvi without using nuget or manage to use nuget 2.12 running from outside monodevelop, which I could not find out how to do.
https://github.com/linvi/tweetinvi
MonoDevelop does not use the NuGet version supplied by Mono that is available from the command line. So updating the command line version of NuGet will not resolve any problems with MonoDevelop.
More recent versions of MonoDevelop use later versions of NuGet.
The last MonoDevelop version 5 release was version 5.10 which supports NuGet 2.8.7.
Support for MonoDevelop 2.12 was added in MonoDevelop 6.0.2. NuGet v3 support was added in MonoDevelop 6.1. Currently MonoDevelop 6 is only available as a FlatPak package unless you build it from source.
If you cannot build MonoDevelop from source you may be able to upgrade NuGet by copying the NuGet.Core.dll from the mono/nuget-binary GitHub repository and copying it into the NuGet addin directory addins/MonoDevelop.PackageManagement, but take a backup copy of the original NuGet.Core.dll before you do that so you can rollback the change if it does not work.
I am the developer of the library and the installation of the library without nuget is not supported on mono because I do not have enough time to look into it.
Tweetinvi supports mono > 4.5 with nuget.

Resources