Skip to content

Commit 46a095e

Browse files
CopilotLeftofZen
andauthored
Finish Avalonia browser enablement
Agent-Logs-Url: https://github.com/OpenLoco/ObjectEditor/sessions/604fe8ad-6228-459c-9512-e3c03dd2c3eb Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
1 parent 0492b4b commit 46a095e

5 files changed

Lines changed: 13 additions & 11 deletions

File tree

Definitions/Definitions.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
</ItemGroup>
4545

4646
<ItemGroup>
47+
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="10.0.5" />
4748
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.5" />
4849
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.5" />
4950
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.5">
@@ -55,10 +56,6 @@
5556
<PackageReference Include="System.IO.Hashing" Version="10.0.5" />
5657
</ItemGroup>
5758

58-
<ItemGroup>
59-
<FrameworkReference Include="Microsoft.AspNetCore.App" />
60-
</ItemGroup>
61-
6259
<ItemGroup>
6360
<ProjectReference Include="..\Common\Common.csproj" />
6461
</ItemGroup>
@@ -67,5 +64,3 @@
6764

6865

6966

70-
71-

Definitions/Web/ClientHelpers.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Common.Logging;
2-
using Microsoft.AspNetCore.Http;
32
using System.Net.Http.Json;
43

54
namespace Definitions.Web;

Gui.Browser/Gui.Browser.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
88
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
9+
<BuildingForBrowser>true</BuildingForBrowser>
910
</PropertyGroup>
1011

1112
<ItemGroup>

Gui/Gui.csproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<OutputType>WinExe</OutputType>
3+
<OutputType Condition="'$(BuildingForBrowser)' == 'true'">Library</OutputType>
4+
<OutputType Condition="'$(BuildingForBrowser)' != 'true'">WinExe</OutputType>
45
<TargetFramework>net10.0</TargetFramework>
56
<LangVersion>preview</LangVersion>
67
<Nullable>enable</Nullable>
78
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
89
<ApplicationManifest>app.manifest</ApplicationManifest>
910
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
10-
<StartupObject>Gui.Program</StartupObject>
11+
<StartupObject Condition="'$(BuildingForBrowser)' != 'true'">Gui.Program</StartupObject>
1112
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1213
<PackageReadmeFile>README.md</PackageReadmeFile>
1314
<RepositoryUrl>https://github.com/OpenLoco/OpenLocoObjectEditor</RepositoryUrl>
@@ -19,7 +20,7 @@
1920
<Version>1.2.3</Version>
2021
<Authors>LeftofZen</Authors>
2122
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
22-
<ApplicationIcon>Assets\loco_icon.ico</ApplicationIcon>
23+
<ApplicationIcon Condition="'$(BuildingForBrowser)' != 'true'">Assets\loco_icon.ico</ApplicationIcon>
2324
</PropertyGroup>
2425

2526
<ItemGroup>
@@ -59,6 +60,7 @@
5960
<PackageReference Include="NAudio" Version="2.3.0" />
6061
<PackageReference Include="NuGet.Versioning" Version="7.3.0" />
6162
<PackageReference Include="PanAndZoom" Version="11.3.9.1" />
63+
<PackageReference Include="ReactiveUI.Avalonia" Version="11.4.12" />
6264
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
6365
<PackageReference Include="ReactiveUI.Validation" Version="7.0.5" />
6466
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.7" />
@@ -67,7 +69,7 @@
6769
<ItemGroup>
6870
<ProjectReference Include="..\Common\Common.csproj" />
6971
<ProjectReference Include="..\Definitions\Definitions.csproj" />
70-
<ProjectReference Include="..\GuiUpdater\GuiUpdater.csproj" />
72+
<ProjectReference Condition="'$(BuildingForBrowser)' != 'true'" Include="..\GuiUpdater\GuiUpdater.csproj" />
7173
<ProjectReference Include="..\Index\Index.csproj" />
7274
</ItemGroup>
7375

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ A modern implementation of 'LocoTool' for Locomotion `dat` file parsing and edit
158158
# Building
159159
- Open `ObjectEditor.sln` in Visual Studio
160160
- You'll need the `Avalonia for Visual Studio` plugin to use the visual XAML previewer, but it isn't required to actually build or run the editor
161+
- Desktop build: `dotnet build Gui/Gui.csproj`
162+
- Browser build: `dotnet build Gui.Browser/Gui.Browser.csproj -p:BuildingForBrowser=true`
163+
- Browser run: `dotnet run --project Gui.Browser/Gui.Browser.csproj`
164+
- This starts Avalonia's local WebAssembly host and prints the local browser URL to open
165+
- Desktop-only features such as opening local folders and separate popup windows remain unavailable in the browser build
161166

162167
# Deploying
163168
See `build.sh` and `tag.sh`

0 commit comments

Comments
 (0)