Skip to content

Upgrade ElectronNET to ElectronNET.Core 0.4.1#3

Merged
xnodeoncode merged 3 commits intomainfrom
development
Mar 7, 2026
Merged

Upgrade ElectronNET to ElectronNET.Core 0.4.1#3
xnodeoncode merged 3 commits intomainfrom
development

Conversation

@xnodeoncode
Copy link
Owner

Upgrade ElectronNET, fixed issues with application path, and added runtime identifiers.

@xnodeoncode xnodeoncode requested review from Copilot and xskcdf March 7, 2026 13:42
@xnodeoncode xnodeoncode self-assigned this Mar 7, 2026
@xnodeoncode xnodeoncode added the enhancement New feature or request label Mar 7, 2026
@xnodeoncode xnodeoncode merged commit 822e66c into main Mar 7, 2026
4 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Upgrades the desktop packaging/runtime setup for Nine’s Electron-hosted Blazor app, including moving to ElectronNET.Core and adjusting publish/build configuration to better support OS-specific deployment.

Changes:

  • Replace ElectronNET.API package usage with ElectronNET.Core / ElectronNET.Core.AspNet and update Electron-related MSBuild properties.
  • Rework Electron startup flow in Program.cs (Electron “ready” callback) and simplify path handling to use OS user-data locations.
  • Add electron-builder config + publish profiles and update ignore rules for publish output.

Reviewed changes

Copilot reviewed 11 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
4-Nine/desktop-config.bk Adds a desktop config backup/legacy file for Electron packaging settings.
4-Nine/Shared/Components/Account/Pages/Register.razor Comments out external login registration section in the UI.
4-Nine/Shared/App.razor Updates the referenced isolated CSS bundle filename.
4-Nine/Services/ElectronPathService.cs Simplifies DB/user-data path resolution to always use OS user-data path.
4-Nine/Properties/electron-builder.json Adds electron-builder packaging configuration (mac/win/linux).
4-Nine/Properties/PublishProfiles/win-x64.pubxml Adds Windows self-contained publish profile.
4-Nine/Properties/PublishProfiles/linux-x64.pubxml Adds Linux self-contained publish profile.
4-Nine/Program.cs Switches to Electron-only startup path and adds Electron “ready” callback window creation.
4-Nine/Nine.csproj Moves to ElectronNET.Core packages, adds Electron-related MSBuild properties, sets RID per OS.
4-Nine/ElectronHostHook/tsconfig.json Removes ElectronHostHook TypeScript config.
4-Nine/ElectronHostHook/package.json Removes ElectronHostHook npm package manifest.
4-Nine/ElectronHostHook/package-lock.json Removes ElectronHostHook npm lockfile.
1-Nine.Infrastructure/Nine.Infrastructure.csproj Adds ASP.NET Core framework reference; removes ElectronNET.API package reference.
.gitignore Ignores Electron publish output directory.
Files not reviewed (1)
  • 4-Nine/ElectronHostHook/package-lock.json: Language not supported

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 28 to +72
@@ -53,11 +47,8 @@
builder.Services.AddAntiforgery(options =>
{
options.HeaderName = "X-CSRF-TOKEN";
// Allow cookies over HTTP for Electron/Development
if (HybridSupport.IsElectronActive || builder.Environment.IsDevelopment())
{
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
}
// Electron runs over plain HTTP — cookies must not require HTTPS
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
});


@@ -77,15 +68,8 @@
builder.Services.AddScoped<IdentityRedirectManager>();
builder.Services.AddScoped<AuthenticationStateProvider, IdentityRevalidatingAuthenticationStateProvider>();

// Add platform-specific infrastructure services (Database, Identity, Path services)
if (HybridSupport.IsElectronActive)
{
builder.Services.AddElectronServices(builder.Configuration);
}
else
{
builder.Services.AddWebServices(builder.Configuration);
}
// Electron-only: always use Electron services (user-data DB path, etc.)
builder.Services.AddElectronServices(builder.Configuration);
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes the app Electron-only (always UseElectron, fixed URL binding to :8888, and always AddElectronServices) and removes the previous web-mode branching. The PR description only mentions upgrading ElectronNET and path/RID fixes; if web hosting is still a supported deployment, this is a breaking behavior change that should either be reverted or explicitly documented/guarded behind a config flag.

Copilot uses AI. Check for mistakes.
<link rel="stylesheet" href="@Assets["app.css"]" />
<link rel="stylesheet" href="_content/Nine.Shared.UI/css/organization-switcher.css" />
<link rel="stylesheet" href="@Assets["Nine.styles.css"]" />
<link rel="stylesheet" href="@Assets["co.nineapp.nine.styles.css"]" />
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isolated CSS bundle name is typically based on the project/assembly name (defaulting to Nine.styles.css). This project file doesn’t set <AssemblyName>, so referencing co.nineapp.nine.styles.css is likely to 404 and drop component-scoped styles. Either set <AssemblyName> to match, or revert the link to the actual generated *.styles.css name.

Suggested change
<link rel="stylesheet" href="@Assets["co.nineapp.nine.styles.css"]" />
<link rel="stylesheet" href="@Assets["Nine.styles.css"]" />

Copilot uses AI. Check for mistakes.
"files": ["**/*"],
"mac": {
"target": "dmg",
"icon": "Assets/icon.icns",
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macOS build config points to Assets/icon.icns, but there is no icon.icns under 4-Nine/Assets/ in this repo (only icon.png and icon.ico). Packaging for macOS will fail unless an .icns is added or the config is updated to a file that exists.

Suggested change
"icon": "Assets/icon.icns",
"icon": "Assets/icon.png",

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +42
"from": "Assets/co.nineapp.nine.appdata.xml",
"to": "usr/share/metainfo/co.nineapp.nine.appdata.xml"
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux extraFiles references Assets/co.nineapp.nine.appdata.xml, but the repository contains 4-Nine/Assets/com.nineapp.nine.appdata.xml (different prefix/path). Electron-builder will fail to copy this file unless the filename/path is aligned.

Suggested change
"from": "Assets/co.nineapp.nine.appdata.xml",
"to": "usr/share/metainfo/co.nineapp.nine.appdata.xml"
"from": "Assets/com.nineapp.nine.appdata.xml",
"to": "usr/share/metainfo/com.nineapp.nine.appdata.xml"

Copilot uses AI. Check for mistakes.
<ElectronSingleInstance>false</ElectronSingleInstance>
<ElectronSplashScreen>wwwroot/assets/splash.png</ElectronSplashScreen>
<ElectronIcon>Assets/icon.png</ElectronIcon>
<ElectronPackageId>co.nineapp.nine</ElectronPackageId>
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ElectronPackageId is set to co.nineapp.nine, but existing desktop metadata in the repo uses com.nineapp.nine (e.g., Assets/com.nineapp.nine.appdata.xml, and the added desktop-config.bk uses com.nineapp.nine). This inconsistency can break Linux metadata copying and app identity/update behavior; pick one identifier and make the configs/assets consistent.

Suggested change
<ElectronPackageId>co.nineapp.nine</ElectronPackageId>
<ElectronPackageId>com.nineapp.nine</ElectronPackageId>

Copilot uses AI. Check for mistakes.
{
app.Logger.LogWarning("Loading offline page due to backend unavailability");
window.LoadURL($"{backendUrl}/offline.html");
}
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ElectronAppReady() never navigates to the main app when the backend health check succeeds. LoadURL() is only called for the offline page, so when isBackendReady is true the window will stay blank. Add an else branch (or unconditional default) to load the normal backendUrl (e.g., /) when the backend is healthy.

Suggested change
}
}
else
{
app.Logger.LogInformation("Backend is ready, loading main application");
window.LoadURL(backendUrl);
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants