Azure Dev Ops - Building an Xamarin Project fails - xamarin.forms

I have created a Xamarin Forms solution that contains both an iOS and an Andoid project that uses F#. I created a Azure Dev Ops pipeline (classic template, no YAML) and I am getting the following error when it attempts to build:
error FS3053 : The type provider
'Xamarin.Android.FSharp.ResourceProvider' reported an error : The type
provider constructor has thrown an exception: [error CS0009: Metadata
file
`/Users/runner/runners/2.165.2/work/1/s/src/packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.dll'
does not contain valid metadata]
[/Users/runner/runners/2.165.2/work/1/s/src/Droid/sameroom.mobile.droid.fsproj]
Can anyone add some insight from here? It works fine building/running on my local macbook.

I found the answer. Instead of using the OOB Xamarin.iOS Build Solution task, use the MSBuild task and only point to the iOS project (iOS.fsproj)

Related

Build a test project

iam building a MAUI Project with a mstest project.
The MAUI project builds totally fine, the test project was building fine but i added a android and iOS as a targetedframeworks in the csproj file becasue i need to build the test for these platforms aswell. so i get the following error when iam trying to build the test project:
"Error Empty ResolveFrameworkReference.RuntimePackPath while trying to read runtime components manifest. ResolvedFrameworkReference available: { Microsoft.NETCore.App, RuntimePackPath: } XXXapp.Test C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.MonoTargets.Sdk\6.0.11\Sdk\RuntimeComponentManifest.targets"
could anybody please help, thanks
i tried to update the .net sdk but no success

Xamarin App crashes after testFlight release before my code runs

Hello and thank you for reading.
This is my first time publishing an ios application and I am using Xamarin to publish my app to both Android and iOS (as requested by the client ).
Now the application deploys and works correctly when I run it via visual studio/Rider but when I push it to testflight (via azure pipeline and microsoft App Center) I get the following Crash report:
link to crashreport
oke so after some triel and error I have found the problem:
Apparently in Xamarin if you use EFCore then there is the possibility of mTouch to skip the reflections used by it
more info (and my saving grace) was found here:
https://learn.microsoft.com/en-us/ef/core/get-started/xamarin#explore-the-code

Publishing a self contained .net core 3.1 WPF app with a C++/CLI dependency fails-should this be supported?

I'm trying to port a WPF app to .net core 3.1, and I'm running into issues with a C++/CLI dependency. The main project is a C# .net core app, but it references a C++/CLI DLL as a managed wrapper to an unmanaged dependency. The project works, and will publish if I make the deployment mode framework dependent (VS 2019 enterprise 16.5.4), but if I flip it to self-contained (which is part of the point of going to core), I get a very unhelpful publish error:
Publish has encountered an error.
Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
The output log simply says:
4/21/2020 8:58:07 PM
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.Exception: Publish has encountered an error. We were unable to > determine the cause of the error. Check the output log for more details. <---
System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
Which is not helpful. Looking through the output from VS in the publish step though, I see this statement:
3>Using "NETSdkError" task from assembly "C:\Program Files\dotnet\sdk\3.1.201\Sdks\Microsoft.NET.Sdk\targets..\tools\net472/Microsoft.NET.Build.Tasks.dll".
3>C++/CLI projects targeting .NET Core cannot use SelfContained=true.
3>Building with tools version "Current".
I tried digging around for an answer, but wasn't able to find one. My question is-does .net core really not support publishing self contained projects when managed C++ is used?

Xamarin.Forms Shared Project: System.DllNotFoundException: /system/lib/libsqlite.so

I have been using the SQLite.cs and SQLiteAsync.cs classes in my Shared Poject for over a year without issue. However, Google now requires that you set Android projects with a target of at least 8.0 (26) when uploading apps to Google Play. Setting the target version to 26 is causing the SQLite.cs and SQLiteAsync.cs classes to no longer work in my app. Any SQLite operations result in the following error:
System.DllNotFoundException: /system/lib/libsqlite.so
The well-documented solution for this is to either set target to below 26 (no longer feasible), or to update the sqlite-net-pcl nuget, as per these posts:
Xamarin error System.DllNotFoundException: /system/lib/libsqlite.so on Android 7.0
System.DllNotFoundException: /system/lib/libsqlite.so- Xamarin Forms
However, this only applies to PCL projects. Does anyone know of a fix for Shared Projects?

how to start working on xamarin with signalr

I'm new to both Xamarin and SignalR. While I'm able to easily follow the tutorials for SignalR on Visual Studio, and get a sample chat application working, I'm not able to make it work on Xamarin. I tried to reference the signalr assemblies in Xamarin, but it fails with the following error -
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Security, Version=4.0.0.0, Culture=neutral
But I'm not able to find System.Security to add to references.
Am I doing this right?
I also tried looking for SignalR in Components. But couldn't find it.
Also, I tried to find some tutorials on SignalR in Xamarin that would guide me through this process. But I wasn't able to find any. Can someone point me to some blogs/tutorials that can help me setup SignalR in Xamarin?
Thanks!
These steps worked for me:
Installed the beta updates on Xamarin
Got the dev branch on signalr and built it to include mono support
Removed reference to signalr.core assembly (this was the one referencing system.security)
If you are on Xamarin.Forms Net standard
(https://blog.xamarin.com/building-xamarin-forms-apps-net-standard/), just install nuget 'Microsoft.AspNet.SignalR.Client' and use all sample code provided by microsoft for NET client (https://learn.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/hubs-api-guide-net-client) into your shared code.

Resources