Single project solution for Uno. Supported platforms:
net8.0-maccatalyst;net8.0-android;net8.0-ios;net8.0-macos
)net8.0-windows10.0.19041.0
or any other net8.0-windows10
)net8.0-webassembly
)net8.0-gtk
)net8.0-windows
)(this is an implicit indication for net8.0-windows7
)net8.0-linux
)net8.0-tizen
)(Untested)Project Structure like MAUI:
Here are three possible uses:
<Project Sdk="H.Uno.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-maccatalyst;net8.0-android;net8.0-ios;net8.0-webassembly;net8.0-gtk;net8.0-linux;net8.0-windows</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
</PropertyGroup>
</Project>
<Project Sdk="H.Uno.Sdk/0.27.0">
<PropertyGroup>
<TargetFrameworks>net8.0-maccatalyst;net8.0-android;net8.0-ios;net8.0-webassembly;net8.0-gtk;net8.0-linux;net8.0-windows</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
</PropertyGroup>
</Project>
Note: For some cases to restore correctly from NuGet you need to run this in a project where net8.0-webassembly;net8.0-gtk;net8.0-linux
is missing
Microsoft.NET.Sdk
and <UseUno>true</UseUno>
after installing the workload<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-maccatalyst;net8.0-android;net8.0-ios;net8.0-webassembly;net8.0-gtk;net8.0-linux;net8.0-windows</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<UseUno>true</UseUno> <!-- or UseUnoUwp -->
</PropertyGroup>
</Project>
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 net8.0-gtk
Although you don't have to do this for NuGet way, full support for the custom target frameworks requires installing the appropriate workload:
curl -sSL https://raw.githubusercontent.com/HavenDV/Uno.Sdk/main/scripts/workload-install.sh | sudo bash
Invoke-WebRequest 'https://raw.githubusercontent.com/HavenDV/Uno.Sdk/main/scripts/workload-install.ps1' -OutFile 'workload-install.ps1';
./workload-install.ps1
dotnet workload uninstall uno
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 PackageReferencesAlthough 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).
Official documentation regarding the design of Workloads and Sdks:
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