Fix wasm deployment issue (#827)
* fix: update wasm-tools installation * fix: add TrimmerRootAssembly for WASM optimization * fix: update project to target .NET 10 and adjust deployment settings * fix: add TrimmerRootAssembly for Ursa.Demo to improve WASM optimization * fix: avoid Window based dialog crash on non-supported platforms.
This commit is contained in:
8
.github/workflows/deploy.yml
vendored
8
.github/workflows/deploy.yml
vendored
@@ -2,7 +2,7 @@ name: Deploy to GitHub Pages
|
||||
|
||||
env:
|
||||
PROJECT_PATH: demo/Ursa.Demo.Browser/Ursa.Demo.Browser.csproj
|
||||
OUTPUT_PATH: demo/Ursa.Demo.Browser/bin/Release/net8.0-browser/publish/wwwroot
|
||||
OUTPUT_PATH: demo/Ursa.Demo.Browser/bin/Release/net10.0-browser/publish/wwwroot
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -13,10 +13,10 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4.1.1
|
||||
|
||||
- name: Setup .NET 8
|
||||
uses: actions/setup-dotnet@v4
|
||||
- name: Setup .NET 10
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
|
||||
- name: Install wasm-tools
|
||||
run: dotnet workload install wasm-tools
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WebAssembly">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-browser</TargetFramework>
|
||||
<TargetFramework>net10.0-browser</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -10,8 +10,14 @@
|
||||
<AvaloniaResource Include="Assets\**"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TrimmerRootAssembly Include="Ursa.Demo" />
|
||||
<TrimmerRootAssembly Include="Ursa.Demo.Browser" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Browser" Version="$(AvaloniaVersion)"/>
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" Version="3.119.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -30,6 +30,6 @@ public class ButtonItem
|
||||
|
||||
private async Task Invoke()
|
||||
{
|
||||
await MessageBox.ShowAsync("Hello " + Name);
|
||||
await MessageBox.ShowOverlayAsync("Hello " + Name);
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,11 @@ public partial class DefaultWindowDialogDemoViewModel: ObservableObject
|
||||
|
||||
private async Task ShowDialog()
|
||||
{
|
||||
if(OperatingSystem.IsBrowser() || OperatingSystem.IsAndroid() || OperatingSystem.IsIOS())
|
||||
{
|
||||
await MessageBox.ShowOverlayAsync("Window dialogs are not supported on this platform. Please use overlay dialogs instead.");
|
||||
return;
|
||||
}
|
||||
var options = new DialogOptions()
|
||||
{
|
||||
Title = Title,
|
||||
@@ -92,6 +97,11 @@ public partial class CustomWindowDialogDemoViewModel: ObservableObject
|
||||
|
||||
private async Task ShowDialog()
|
||||
{
|
||||
if(OperatingSystem.IsBrowser() || OperatingSystem.IsAndroid() || OperatingSystem.IsIOS())
|
||||
{
|
||||
await MessageBox.ShowOverlayAsync("Window dialogs are not supported on this platform. Please use overlay dialogs instead.");
|
||||
return;
|
||||
}
|
||||
var options = new DialogOptions()
|
||||
{
|
||||
Title = Title,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Markup.Xaml.MarkupExtensions;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ursa.Controls;
|
||||
@@ -126,6 +127,12 @@ public class MessageBoxDemoViewModel: ObservableObject
|
||||
}
|
||||
else
|
||||
{
|
||||
if (OperatingSystem.IsBrowser() || OperatingSystem.IsAndroid() || OperatingSystem.IsIOS())
|
||||
{
|
||||
await MessageBox.ShowOverlayAsync("Only overlay message box is supported on this platform.",
|
||||
"Ursa MessageBox", button: MessageBoxButton.OK, icon: MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
Result = await MessageBox.ShowAsync(_message, _title, icon: SelectedIcon, button:button);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user