This question is about the use of .Net Standard in a Xamarin.Forms project targeting iOS (but also Android).
Please excuse my frustration but with the transition between PCL to .Net Standard I feel we are in a kind of limbo with very little working out of the box and very little information on how to deal with edge cases or not-even-so-edgy-cases.
I've read (many)(different) guides and the vocabulary is mildly confusing as well as the fact that you need to edit your .csproj files will small undocumented hacks to work around things that aren't working out of the box yet (many NuGet related issues that aren't approached in the Hi! This is how you convert from PCL to the great .Net Standard happy videos).
I've read through
What I've done
1. Created a new blank Xamarin.Forms app, targeting iOS and Android and using PCL, using Visual Studio for Mac
2. Following the steps of @JamesMontemagno, created a new .Net Standard library project and added Xamarin.Forms 2.4.0 via Nuget
If I understand well, at this point, my new core application project is a .Net Core project.
3. Added NuGet dependency toward Microsoft.Rest.ClientRuntime because my application uses an autogenerated REST Api definition created using autorest
4. Added my core application project as a reference to my iOS project. Question here: What type or project is the iOS project here? .Net Framework project? Or something else? How do/can I create a .Net Core/Standard iOS project?
Then I build and run my application. When I hit a button that trigger the use of Microsoft.Rest.ClientRuntime, I get the following error:
Could not load type of field 'MyApp.MyPage+d__3:5__2' (4) due to: Could not load file or assembly 'Microsoft.Rest.ClientRuntime, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. assembly:Microsoft.Rest.ClientRuntime, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type: member:
If I add Microsoft.Rest.ClientRuntime NuGet package as a dependency to the iOS project then it does work but:
1. It's pulling a hell lot of NuGet dependencies
2. That's not how it used to work with PCL
So I wondered if there's anything documented about referencing .Net Standard from old-not-so-standard projects (<rant>A problem not approached in the happy-little-videos</rant>) and found this:
But it does not seem to work, at least not for my iOS project using Visual Studio for Mac.
Any suggestion on how to solve this? Or how am I supposed to set up my iOS app project to use the .Net Standard project?