avalonia
with screenshots.
Avalonia classic project
Creating project in Visual Studio or Rider
Updating target frameworks in project file
We need to change the project target platforms from generic .net8 to a custom framework for each platform.
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('OSX'))">
<TargetFramework>net8.0-macos14.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('Linux'))">
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
Add NuGet packages for each platform.
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<PackageReference Include="VisioForge.CrossPlatform.Core.Windows.x64" Version="15.10.24" />
<PackageReference Include="VisioForge.CrossPlatform.Libav.Windows.x64.UPX" Version="15.10.24" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('OSX'))">
<PackageReference Include="VisioForge.CrossPlatform.Core.macOS" Version="15.10.11" />
</ItemGroup>
Linux deployment link.
Check that I can add mobile platforms to non-MVVM project.
Avalonia MVVM with mobile platforms project
Creating project in Visual Studio or Rider
Updating target frameworks in project file
<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<TargetFrameworks>$(TargetFrameworks);net8.0-windows</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('OSX'))">
<TargetFrameworks>$(TargetFrameworks);net8.0-macos14.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('Linux'))">
<TargetFrameworks>$(TargetFrameworks);net8.0</TargetFrameworks>
</PropertyGroup>
Add NuGet packages to csproj for each platform
Desktop project
Update frameworks in csproj and add NuGet redist packages.
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
</PropertyGroup>
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('Windows'))">
<PackageReference Include="VisioForge.CrossPlatform.Core.Windows.x64" Version="15.10.24" />
<PackageReference Include="VisioForge.CrossPlatform.Libav.Windows.x64.UPX" Version="15.10.24" />
</ItemGroup>
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('OSX'))">
<TargetFramework>net8.0-macos14.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('OSX'))">
<PackageReference Include="VisioForge.CrossPlatform.Core.macOS" Version="15.10.11" />
</ItemGroup>
<PropertyGroup Condition="$([MSBuild]::IsOsPlatform('Linux'))">
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
Android
<ItemGroup>
<PackageReference Include="VisioForge.CrossPlatform.Core.Android" Version="15.10.24" />
</ItemGroup>
iOS
<ItemGroup>
<PackageReference Include="Avalonia.iOS" Version="$(AvaloniaVersion)" />
</ItemGroup>