Applications created with Electron.NET does not launch after a build #187

Closed
opened 2026-01-29 16:33:10 +00:00 by claunia · 10 comments
Owner

Originally created by @ABWhiskey on GitHub (Jun 19, 2018).

Hello

I start with Electron.net and I have a little problem with:

To explain, I will take example on the demo of Electron.net provided on github: Electron.NET API Demos.

  1. I download the zip of the demo and unzip it
  2. I go to the directory that contains the necessary files for launching and compilation.
  3. I type the commands in a terminal:
- dotnet restore
- dotnet electronize start

Here, no problem, the window launches very well.

Now, I want to build to have a final executable. To do this, I run the command:

dotnet electronize build /target win

The build command goes very well too, the files are generated.

The trouble is that if I run the executable, I have this:

info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\Whiskey\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Production
Content root path: F:\Dev\CNet\electron.net-api-demos-master\electron.net-api-demos-master\ElectronNET-API-Demos\obj\desktop\win\bin
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.

Then nothing, the window is not displayed.

Did I miss something ?

PS: I am on Windows 10, with node v10.4.1 and last dotnet core installed.

Thanks,
Regards,

Originally created by @ABWhiskey on GitHub (Jun 19, 2018). Hello I start with Electron.net and I have a little problem with: To explain, I will take example on the demo of Electron.net provided on github: Electron.NET API Demos. 1. I download the zip of the demo and unzip it 2. I go to the directory that contains the necessary files for launching and compilation. 3. I type the commands in a terminal: ``` - dotnet restore - dotnet electronize start ``` Here, no problem, the window launches very well. Now, I want to build to have a final executable. To do this, I run the command: ` dotnet electronize build /target win` The build command goes very well too, the files are generated. The trouble is that if I run the executable, I have this: > info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] > User profile is available. Using 'C:\Users\Whiskey\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. > Hosting environment: Production > Content root path: F:\Dev\CNet\electron.net-api-demos-master\electron.net-api-demos-master\ElectronNET-API-Demos\obj\desktop\win\bin > Now listening on: http://localhost:5000 > Application started. Press Ctrl+C to shut down. Then nothing, the window is not displayed. Did I miss something ? PS: I am on Windows 10, with node v10.4.1 and last dotnet core installed. Thanks, Regards,
Author
Owner

@kwakuduahc1 commented on GitHub (Jun 22, 2018):

Can you share the code or develop a simple sample that produces the problem. If I have been doing my correctly, your output should not show at all.

@kwakuduahc1 commented on GitHub (Jun 22, 2018): Can you share the code or develop a simple sample that produces the problem. If I have been doing my correctly, your output should not show at all.
Author
Owner

@ABWhiskey commented on GitHub (Jun 22, 2018):

Hello

As requested, in attached part, a minimal project for Electron.NET. I have cleaned up the project a bit so I can post it here but it remains functional.

In the folder that contains the Program.cs file, just type:

dotnet restore
dotnet electronize start

I followed this tutorial to make the skeleton of the application : https://www.youtube.com/watch?v=nuM6AojRFHk

The problem is that with the start command, the program works. But when I publish it and run the executable, this is a problem, the window is not displayed.

Thanks,
Regards.

ElectronNETBase.zip

@ABWhiskey commented on GitHub (Jun 22, 2018): Hello As requested, in attached part, a minimal project for Electron.NET. I have cleaned up the project a bit so I can post it here but it remains functional. In the folder that contains the Program.cs file, just type: `` dotnet restore `` ``dotnet electronize start `` I followed this tutorial to make the skeleton of the application : https://www.youtube.com/watch?v=nuM6AojRFHk The problem is that with the start command, the program works. But when I publish it and run the executable, this is a problem, the window is not displayed. Thanks, Regards. [ElectronNETBase.zip](https://github.com/ElectronNET/Electron.NET/files/2127323/ElectronNETBase.zip)
Author
Owner

@kwakuduahc1 commented on GitHub (Jun 22, 2018):

I run this
dotnet electronize build /target win7-x86
and everything seems to work fine. Use the code for your publishing or refer to publishing targets in the documentation

@kwakuduahc1 commented on GitHub (Jun 22, 2018): I run this <code>dotnet electronize build /target win7-x86</code> and everything seems to work fine. Use the code for your publishing or refer to publishing targets in the documentation
Author
Owner

@ABWhiskey commented on GitHub (Jun 22, 2018):

I just tested your command line. It builds well, I have the executable but the same problem, it stops after "Application Started, Press Ctrl + C to shutdown", and of course, no window appears. :(

I feel that the bridgeconnector does not work.

@ABWhiskey commented on GitHub (Jun 22, 2018): I just tested your command line. It builds well, I have the executable but the same problem, it stops after "Application Started, Press Ctrl + C to shutdown", and of course, no window appears. :( I feel that the bridgeconnector does not work.
Author
Owner

@ABWhiskey commented on GitHub (Jun 24, 2018):

Good I advance on my problem. To launch it I have an alternative that works but I would have preferred an executable.

In the home directory (where the main.js file is), I created a script:

.\node_modules\electron\dist\electron main.js

Once the script is launched, the window appears well. Not very practical compared to an executable but it works.

Regards.

@ABWhiskey commented on GitHub (Jun 24, 2018): Good I advance on my problem. To launch it I have an alternative that works but I would have preferred an executable. In the home directory (where the main.js file is), I created a script: `` .\node_modules\electron\dist\electron main.js `` Once the script is launched, the window appears well. Not very practical compared to an executable but it works. Regards.
Author
Owner

@tiyero commented on GitHub (Jun 28, 2018):

Hello
I build Linux.Please,How to run on Centos7,Thank You.

@tiyero commented on GitHub (Jun 28, 2018): Hello I build Linux.Please,How to run on Centos7,Thank You.
Author
Owner

@ABWhiskey commented on GitHub (Jun 28, 2018):

Hello

Launch the command:

dotnet electronize build /target linux

Normally, it should pass.

If your application does not run, try creating a bash script with the executable electron (created using the command above) and main.js. I do not have linux on my machine, so I can not say exactly where the executable electron is, but it must be somewhere in this directory:

./node_modules/electron/dist/electron

Regards.

@ABWhiskey commented on GitHub (Jun 28, 2018): Hello Launch the command: ``dotnet electronize build /target linux`` Normally, it should pass. If your application does not run, try creating a bash script with the executable electron (created using the command above) and main.js. I do not have linux on my machine, so I can not say exactly where the executable electron is, but it must be somewhere in this directory: ``./node_modules/electron/dist/electron`` Regards.
Author
Owner

@EldinZenderink commented on GitHub (Jul 17, 2018):

I had the same issue where the bloody thing just wouldnt run on Ubuntu (not sure if it's closely related, as I am a linux noob). But by doing chmod -R u+x . in the directory where the executable is located, it worked for me. Apparently some files do not have the right permissions set after building with target /linux.

This is again not a real solution but for testing this works fine for me.

Edit: I was compiling on a windows machine, hence apparently some permissions are not copied across different machines according to this form: https://unix.stackexchange.com/questions/338680/executable-file-problem-after-transfer-to-other-system

So, this might not apply for you.

Quit interesting.

@EldinZenderink commented on GitHub (Jul 17, 2018): I had the same issue where the bloody thing just wouldnt run on Ubuntu (not sure if it's closely related, as I am a linux noob). But by doing `chmod -R u+x .` in the directory where the executable is located, it worked for me. Apparently some files do not have the right permissions set after building with target /linux. This is again not a real solution but for testing this works fine for me. Edit: I was compiling on a windows machine, hence apparently some permissions are not copied across different machines according to this form: https://unix.stackexchange.com/questions/338680/executable-file-problem-after-transfer-to-other-system So, this might not apply for you. Quit interesting.
Author
Owner

@jadhavrani123 commented on GitHub (Feb 29, 2020):

I want to store my ElectronNet exe in system tray at the time of PC shutdown

@jadhavrani123 commented on GitHub (Feb 29, 2020): I want to store my ElectronNet exe in system tray at the time of PC shutdown
Author
Owner

@jadhavrani123 commented on GitHub (Mar 9, 2020):

Sir I want to close my developer tool on click cntrl + shift + I

WebPreferences = new WebPreferences
{
DevTools = false
}
I am use this code........but it not work for me

@jadhavrani123 commented on GitHub (Mar 9, 2020): Sir I want to close my developer tool on click cntrl + shift + I WebPreferences = new WebPreferences { DevTools = false } I am use this code........but it not work for me
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#187