

How to Move Uno Platform Pages to a Multi-Targeting Library
source link: https://christianfindlay.com/2020/08/25/uno-multitargeting/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to Move Uno Platform Pages to a Multi-Targeting Library – ChristianFindlay.comSkip to content
You can move Uno Platform pages and other code into a multi-targeted library that you can reference from the Uno Platform head projects. This is much more convenient than using Visual Studio Shared libraries. Shared libraries don’t seem to have full support in Visual Studio, and some features like quick refactors often don’t work. This article briefly explains what I did to get this working. I completely removed the shared library in my sample. You can clone my working sample here.
Check out my Udemy course Introduction To Uno Platform.
This video gives you a quick overview of creating a multi-targeting library and moving a page into it.
This article gives you a much more comprehensive step by step guide to converting an existing solution to used a multi-targeting library. Also, this process seems support hot-reload.
The trick is that this template project uses SDK type MSBuild.Sdk.Extras . These types of projects build for all the different platforms mentioned. Here is some of the config in the csproj file. The noteworthy part is the TargetFrameworks. We can’t merely build for .NET Standard. We need libraries for all the platforms we want to target.
<PropertyGroup> <TargetFrameworks>uap10.0.16299;netstandard2.0;xamarinios10;xamarinmac20;MonoAndroid90;monoandroid10.0</TargetFrameworks> <!-- Ensures the .xr.xml files are generated in a proper layout folder --> <GenerateLibraryLayout>true</GenerateLibraryLayout> <LangVersion>8.0</LangVersion> <Nullable>enable</Nullable> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup>
I took the time to add some basic features to the project so that you can get started with Uno Platform development quickly. Also, it gives you Cat Facts! The only extra dependency I have added is to RestClient.Net, which the app uses to make Web API calls. These are the features of the project at the time of publishing this article. I will try to update and fix this sample moving into the future.
- Current version of Uno Platform (3.0.12)
- C# version 8
- FxCop with my flavor of code rules. This prevents common coding mistakes. Check out the documentation at the Roslyn Github repo.
- RestClient .Net for APIs
- ViewModel with binding
- ICommands
- Converters
- No shared project
- Nullable turned on. This a feature of C# 8 to reduce the need for null checking
In Progress
- Hot reload doesn’t seem to work. Shout out if you know why!
- There is a build problem on Mac because it cannot build for UWP. Let me know if you know how to ignore this on Mac for Visual Studio
Watch a video of the app:
Wrap-up
Grab the sample and get started building an app. If you found this information useful, check out my Udemy course Introduction To Uno Platform.
Like this:
Recommend
-
54
Vugu Vugu is an experimental library for web UIs written in Go and targeting webassembly. Guide and docs at http://www.vugu.org . Godoc at
-
15
jueves, 25 de marzo de 202118:00 hasta el 19:00 CETEvento en líneaEnlace visible para los asistentes
-
4
The Importance of Multi-Location Landing Pages • CryptoMode Search If you’re a small mom and pop business, you’ve probably found that
-
4
The MAUI way: a single Project With Xamarin.Forms, we typically had this kind of project structure: A shared project, containing all of our shared code and different ‘head’ projects for each platform you want to target.
-
10
Fable.SimpleJson.Python A library for working with JSON in F# Fable projects targeting Python Install from nuget dotnet add package Fable.SimpleJson.Python Use it in your project
-
3
First malware targeting AWS Lambda serverless platform disclosed Image Credit: AWS We are excited to bring Transform 2022 back in...
-
8
New issue library: Move CStr to libcore, and CString to liballoc #94079 ...
-
5
Meta’s Adding More Ad Targeting Information to its Ad Library Listings Published May 23, 2022 By
-
8
Redirecting GitHub Pages after a repository move The problem You have a repository, call it alice/repo. You would like to transfer it to the user bob, so it will become bob/repo.
-
7
SpaceflightSpaceX Rival Rocket Lab Targeting Multi-Continent Launches Later This MonthIn addition, the U.S. launch com...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK