fix: update the latest template of Browser project.

This commit is contained in:
Zhang Dian 2024-03-12 17:16:23 +08:00
parent 4b7674d7e2
commit ef272815ea
7 changed files with 11 additions and 10 deletions

View File

@ -7,9 +7,9 @@ using Avalonia.Browser;
namespace Semi.Avalonia.Demo.Web;
internal partial class Program
internal sealed partial class Program
{
private static async Task Main(string[] args) => await BuildAvaloniaApp()
private static Task Main(string[] args) => BuildAvaloniaApp()
.StartBrowserAppAsync("out");
public static AppBuilder BuildAvaloniaApp()

View File

@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<WasmMainJSPath>AppBundle\main.js</WasmMainJSPath>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-browser</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<WasmMainJSPath>wwwroot\main.js</WasmMainJSPath>
<WasmRuntimeAssetsLocation>./_framework</WasmRuntimeAssetsLocation>
</PropertyGroup>
<ItemGroup>
<WasmExtraFilesToDeploy Include="AppBundle\**" />
<WasmExtraFilesToDeploy Include="wwwroot\**"/>
</ItemGroup>
<ItemGroup>

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 172 KiB

View File

@ -7,8 +7,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="/" />
<link rel="modulepreload" href="./main.js" />
<link rel="modulepreload" href="./dotnet.js" />
<link rel="modulepreload" href="./avalonia.js" />
<link rel="modulepreload" href="./_framework/dotnet.js" />
<link rel="modulepreload" href="./_framework/avalonia.js" />
<link rel="stylesheet" href="./app.css" />
</head>

View File

@ -1,4 +1,4 @@
import { dotnet } from './dotnet.js'
import { dotnet } from './_framework/dotnet.js'
const is_browser = typeof window != "undefined";
if (!is_browser) throw new Error(`Expected to be running in a browser`);
@ -10,4 +10,4 @@ const dotnetRuntime = await dotnet
const config = dotnetRuntime.getConfig();
await dotnetRuntime.runMainAndExit(config.mainAssemblyName, [window.location.search]);
await dotnetRuntime.runMain(config.mainAssemblyName, [window.location.search]);