Skip to content

Unable to Publish Project #963

@AeonSake

Description

@AeonSake

Whenever I try to publish an ASP.NET project following the provided steps in the wiki, the build fails with the following exception when running the electron-builder:

ENOENT: no such file or directory, stat '<path_to_solution>\BlazorApp1\BlazorApp1\obj\Release\net10.0\win-x64\PubTmp\Out\node_modules\electron-host-hook'  failedTask=build stackTrace=Error: ENOENT: no such file or directory, stat '<path_to_solution>\BlazorApp1\BlazorApp1\obj\Release\net10.0\win-x64\PubTmp\Out\node_modules\electron-host-hook'
  • NuGet Version: 0.2.0
  • Electron Version: 30.4.0 (not specified in .csproj)
  • Electron Builder Version: 26.0.12 (not specified in .csproj)
  • Framework: net10.0
  • Target: win-x64 (specified via publish profile)
  • IDE: Visual Studio 2026 18.0.1

Steps to Reproduce:

  1. Create a new Blazor Web App, targeting net10.0
  2. Add ElectronNET.Core and ElectronNET.Core.AspNet version 0.2.0 as NuGet packages
  3. Add builder.UseElectron(args, ElectronAppReady); to the builder call and the following method for creating the window:
private static async Task ElectronAppReady()
{
    var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions {Show = false});
    browserWindow.OnReadyToShow += () => browserWindow.Show();
}
  1. Create a publish profile under Properties/PublishProfile (in this case as win-x64.pubxml) with the following content:
<?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>net10.0</TargetFramework>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <SelfContained>true</SelfContained>
    <PublishSingleFile>false</PublishSingleFile>
  </PropertyGroup>
</Project>
  1. Publish the project using the Visual Studio interface

I also tried specifying a specific Electron and electron-builder version in the .csproj file without success. Normal debug/release builds and running it succeed without issues. I tried following the provided wiki pages as close as possible. If I'm doing something wrong, please correct me.

Please note, that this happened in a newly created blank project. I initially ran into this same issue when reworking a more complex project (several package and project dependencies) to use this package. It might be a related issue but publishing that more complex project also DELETED ALL SOURCE FILES within that project directory. Luckily, I had all relevant changes committed or staged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions