-
-
Notifications
You must be signed in to change notification settings - Fork 736
Package Building
ElectronNET.Core integrates with Visual Studio's publishing system to create distributable Electron packages using electron-builder. The process leverages .NET's build system while automatically generating the necessary Electron configuration files.
The publishing process differs slightly between ASP.NET and console applications:
- ASP.NET Apps - Use folder publishing with SelfContained=true
- Console Apps - Use folder publishing with SelfContained=false
Add publish profiles to Properties/PublishProfiles/:
win-x64.pubxml:
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
</PropertyGroup>
</Project>linux-x64.pubxml:
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
</PropertyGroup>
</Project>win-x64.pubxml:
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>linux-x64.pubxml:
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
</PropertyGroup>
</Project>ElectronNET.Core automatically adds a default electron-builder.json file under Properties\electron-builder.json.
Please see here for details of the available configuration options: https://www.electron.build/.
- Right-click your project in Solution Explorer
- Select "Publish"
- Select your publish profile (Windows/Linux)
- Click "Publish"
The publish process will:
- Build your .NET application
- Copy all files as needed
- Install npm dependencies
- Run electron-builder
Note
When running publish for a Linux configuration on Windows, Electron.NET will automatically use WSL for the platform-specific steps.
After publishing, the final results will be in
publish\Release\netx.0\xxx-xxx\
Note
macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per this Electron issue). macOS builds can be produced on either Linux or macOS machines.
- Startup Methods - Understanding different launch modes for packaged apps
- Debugging - Debug packaged applications
- Migration Guide - Update existing projects for new publishing
✅ Native VS Integration - Use familiar publish workflows
✅ Cross-Platform Building - Build Linux packages from Windows
✅ Automatic Configuration - No manual electron-builder setup
✅ Multiple Package Types - NSIS, AppImage, DMG, etc.
✅ CI/CD Ready - Easy integration with build pipelines
Want to contribute to this documentation? Please fork and create a PR! The Wiki is autogenerated from the /docs content in the repository.