Skip to main content
Any Framework

Templates for Uno platforms.

Published
Oct 5, 2023
3y ago
Total Downloads
29.7K
29,658

Deprecated Package Version

Reason: Legacy

Install

dotnet add package H.Uno.Templates --version 0.12.0

No framework information available.

README

Uno.Sdk

Nuget package dotnet License: MIT Discord

Easy configuration for Uno projects in 2 lines of code. Now is only there platforms are supported:

  • Mobile(macOS, MacCatalyst and Android)
  • Windows
  • WebAssembly
  • Skia.Gkt(net7.0-gtk)
  • Skia.Wpf(net7.0-windows)
  • Skia.Linux.Framebuffer(net7.0-linux)
  • Skia.Tizen(net7.0-tizen)(still unsupported)

Usage

Here are three possible uses:

  • Use SDK via NuGet. A small hack will be used here to disable the error message about missing workloads for webassembly/linux/gtk.
<Project Sdk="H.Uno.Sdk/0.12.0">

    <PropertyGroup>
        <TargetFrameworks>net7.0-maccatalyst;net7.0-android;net7.0-ios;net7.0-webassembly;net7.0-gtk;net7.0-linux;net7.0-windows</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
    </PropertyGroup>

</Project>
  • Use local SDK after installing workload
<Project Sdk="H.Uno.Sdk">

    <PropertyGroup>
        <TargetFrameworks>net7.0-maccatalyst;net7.0-android;net7.0-ios;net7.0-webassembly;net7.0-gtk;net7.0-linux;net7.0-windows</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
    </PropertyGroup>

</Project>
  • Use via Microsoft.NET.Sdk and <UseUno>true</UseUno> after installing the workload (the most correct, but currently not supported due to the fact that WebAssembly requires Microsoft.NET.Sdk.Web which will not work with some target frameworks)
<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFrameworks>net7.0-maccatalyst;net7.0-android;net7.0-ios;net7.0-webassembly;net7.0-gtk;net7.0-linux;net7.0-windows</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
        <UseUno>true</UseUno> <!-- or UseUnoUwp -->
    </PropertyGroup>

</Project>

Fast start

You can use https://github.com/HavenDV/Uno.Sdk.Example/ as a start point or just use templates:

dotnet new install H.Uno.Templates # If you don't have installed workload
mkdir SingleProjectSolution
cd SingleProjectSolution
dotnet new uno
dotnet build
dotnet run --framework net7.0-gtk

Install workload

Although you don't have to do this, full support for the custom target framework requires installing the appropriate workload:

  • On Linux / macOS:
curl -sSL https://raw.githubusercontent.com/HavenDV/Uno.Sdk/main/scripts/workload-install.sh | sudo bash
  • On Windows:
Invoke-WebRequest 'https://raw.githubusercontent.com/HavenDV/Uno.Sdk/main/scripts/workload-install.ps1' -OutFile 'workload-install.ps1';
./workload-install.ps1

Uninstall

dotnet workload uninstall uno

Settings

The SDK is designed to assign default values only to properties that have not been explicitly set by the user. This way the user has full control over what the SDK does. Settings:

  • <UseUnoUwp>true</UseUnoUwp> - will use Uno.UI packages instead of Uno.WinUI.
  • <UnoVersion>5.0.0</UnoVersion (and other versions, see here) - will change the versions of all implicit PackageReferences

Disclaimer

Although this is a working solution, I have simplified some things regarding workload and manifest, which could theoretically cause problems (for example, when upgrading to a new sdk version).

Docs

Official documentation regarding the design of Workloads and Sdks:

Support

Priority place for bugs: https://github.com/HavenDV/Uno.Sdk/issues
Priority place for ideas and general questions: https://github.com/HavenDV/Uno.Sdk/discussions
Discord: https://discord.gg/g8u2t9dKgE

Changes from Previous Version

No structural changes between v0.11.1 and v0.12.0.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

NuGet marks this package as deprecated. Review the publisher's migration guidance before adopting it.No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.