Building
2 minutes read
Prerequisites
- .NET 10 SDK
- Node.js 20+ (includes npm)
- Git
Development
Full Build (Backend + Frontend)
dotnet build
This single command runs the entire MSBuild pipeline:
NpmInstall— runsnpm ciinFrontend/GenerateIpcTs— generatesFrontend/src/lib/ipc.tsfrom C# annotationsBuildFrontend— runsnpm run build(TypeScript + Vite)CopyFrontendDist— copiesFrontend/dist/→bin/.../wwwroot/- Standard .NET compilation
Run
dotnet run
Starts the .NET Console app → spawns Electron → opens the window.
Frontend-Only Dev
cd Frontend
npm run dev # Vite dev server on localhost:5173
Useful for iterating on UI without restarting the full app. Note: IPC calls will not work in standalone mode (no Electron bridge).
Regenerate IPC
node Scripts/generate-ipc.mjs
Or triggered automatically by dotnet build when IpcService.cs changes.
Production Build
# Build frontend for production
cd Frontend && npm run build
# Publish .NET
dotnet publish -c Release
The published output is in bin/Release/net10.0/linux-x64/publish/ (or platform equivalent) and includes the wwwroot/ folder with the compiled frontend.
Platform Notes
Linux
# Standard build
dotnet build
# Production publish
dotnet publish -c Release -r linux-x64
# Flatpak bundle (recommended)
./Scripts/publish.sh flatpak --arch x64
Flatpak packaging is generated by Scripts/publish.sh and Electron Builder. Linux icon assets are generated from Frontend/public/icon.png into Build/icons/ during publish. AppStream metadata source remains Properties/linux/io.github.HyPrismTeam.HyPrism.metainfo.xml.
Release CI (.github/workflows/release.yml) publishes Linux artifacts for linux-x64 only. Linux arm64 release builds are not supported.
macOS
dotnet publish -c Release -r osx-x64
# Or for Apple Silicon:
dotnet publish -c Release -r osx-arm64
See Properties/macos/Info.plist for macOS-specific metadata.
At startup, HyPrism resolves icon.png from multiple packaged locations before calling Electron.Dock.SetIcon(). If the icon is missing, startup continues and the dock-icon call is skipped (no main-process crash).
Frontend favicon for packaged file:// runs is served from Frontend/public/icon.png and referenced as ./icon.png in Frontend/index.html.
For macOS publish (Scripts/publish.sh), Build/icon.icns is regenerated from Frontend/public/icon.png before building DMG artifacts.
Electron Builder icon paths are resolved relative to directories.buildResources (Build/), so icon fields should use icon.png, icon.ico, and icon.icns (not Build/...).
Scripts/publish.sh now writes an absolute directories.buildResources path to Build/ in its generated Electron Builder config so packaged icons resolve consistently in local and CI builds.
Windows
dotnet publish -c Release -r win-x64
MSBuild Targets
| Target | Trigger | Purpose |
|---|---|---|
NpmInstall | Before GenerateIpcTs | npm ci --prefer-offline |
GenerateIpcTs | Before BuildFrontend | node Scripts/generate-ipc.mjs |
BuildFrontend | Before Build | npm run build in Frontend/ |
CopyFrontendDist | After Build | Copy dist → wwwroot |
All targets use incremental build (Inputs/Outputs) to avoid unnecessary work.