All "electronize" commands fail, claiming that dotnet failed even when it does not fail #665

Closed
opened 2026-01-29 16:45:29 +00:00 by claunia · 2 comments
Owner

Originally created by @zaneclaes on GitHub (May 28, 2021).

I am able to run dotnet publish, dotnet build, and yarn build all without errors. However, when I run electronize start or electronize build, I get a failure:

Error occurred during dotnet publish: 1

I searched and found https://github.com/ElectronNET/Electron.NET/issues/206 but since the above commands work, I'm not sure it applies. Specifically, if I run dotnet publish and then echo $?, it prints 0. However, I still get the error message above if I subsequently run electronize start.

Here is the full log from the electronize start command. I don't see any logs that indicate the reason for the build failure. So I dug thru the source code for this repo and attempted to manually recreate the CLI arguments passed to dotnet. Even still, this command succeeds when run manually:

dotnet publish -r osx.11.0-x64 -c Debug /p:PublishSingleFile=true /p:PublishReadyToRun=true --no-self-contained

Since ElectronNET is swallowing the error, I'm not sure what the problem is.

Which version of Electron.NET CLI and API are you using?

11.5.1 for both.

Which version of .NET Core and Node.js are you using (if applicable)?

Dotnet 5.0.102. Node v15.10.0.

What target are you building for?

I'm developing on Mac OS. I have not yet succeeded in building.

Originally created by @zaneclaes on GitHub (May 28, 2021). I am able to run `dotnet publish`, `dotnet build`, and `yarn build` all without errors. However, when I run `electronize start` or `electronize build`, I get a failure: > Error occurred during dotnet publish: 1 I searched and found https://github.com/ElectronNET/Electron.NET/issues/206 but since the above commands work, I'm not sure it applies. Specifically, if I run `dotnet publish` and then `echo $?`, it prints `0`. However, I still get the error message above if I subsequently run `electronize start`. [Here](https://gist.github.com/zaneclaes/dd11de117101d212848f329ddf0ab611) is the full log from the `electronize start` command. I don't see any logs that indicate the reason for the build failure. So I dug thru the source code for this repo and attempted to manually recreate [the CLI arguments passed to dotnet](https://github.com/ElectronNET/Electron.NET/blob/30941df39c49f82720011c2444f4af4cbd7b8569/ElectronNET.CLI/Commands/StartElectronCommand.cs#L110). Even still, this command succeeds when run manually: ``` dotnet publish -r osx.11.0-x64 -c Debug /p:PublishSingleFile=true /p:PublishReadyToRun=true --no-self-contained ``` Since ElectronNET is swallowing the error, I'm not sure what the problem is. **Which version of Electron.NET CLI and API are you using?** --- `11.5.1` for both. **Which version of .NET Core and Node.js are you using (if applicable)?** --- Dotnet `5.0.102`. Node `v15.10.0`. **What target are you building for?** --- I'm developing on Mac OS. I have not yet succeeded in building.
claunia added the bug label 2026-01-29 16:45:29 +00:00
Author
Owner

@zaneclaes commented on GitHub (Jun 8, 2021):

The problem was that electronize does not support the*.csproj format used by the React SPA template. Specifically, the template includes sections that build the NPM project as part of the pre/post-build process. I noticed that this was not present in the example project for dotnet5. Removing them means that npm install (or yarn install) must be completed before the project build, but it fixes the problem.

@zaneclaes commented on GitHub (Jun 8, 2021): The problem was that electronize does not support the`*.csproj` format used by the React SPA template. Specifically, the template includes sections that build the NPM project as part of the pre/post-build process. I noticed that this was not present in the example project for `dotnet5`. Removing them means that `npm install` (or `yarn install`) must be completed before the project build, but it fixes the problem.
Author
Owner

@lukedukeus commented on GitHub (Feb 21, 2024):

Just ran into the same thing, I was also able to fix it by keeping the .csproj file the same and turning off PublishSingleFile by running electronize build /target win /PublishSingleFile false. In my case electronize start worked fine, but building did not work.

@lukedukeus commented on GitHub (Feb 21, 2024): Just ran into the same thing, I was also able to fix it by keeping the `.csproj` file the same and turning off `PublishSingleFile` by running `electronize build /target win /PublishSingleFile false`. In my case `electronize start` worked fine, but building did not work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#665