Why >electronize start does not start the application? #322

Closed
opened 2026-01-29 16:36:26 +00:00 by claunia · 4 comments
Owner

Originally created by @win32nipuh on GitHub (May 21, 2019).

Originally assigned to: @GregorBiswanger on GitHub.

I have build the simple app as Gregor showed in youtube.
It was built in VS2019, all is ok.
But when I do

dotnet electronize start
the app does not appear.
That is all what I see:


PS E:\MyProjects\CrossPlatform\Federmesser\fmapp5> electronize start
Start Electron Desktop Application...
Microsoft Windows [Version 10.0.17134.765]
(c) 2018 Microsoft Corporation. All rights reserved.
E:\MyProjects\CrossPlatform\Federmesser\fmapp5>dotnet publish -r win-x64 --output "E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\bin"
Microsoft (R) Build Engine version 16.1.54-preview+gd004974104 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 594.66 ms for E:\MyProjects\CrossPlatform\Federmesser\fmapp5\FMApp5.csproj.
C:\Program Files\dotnet\sdk\3.0.100-preview4-011223\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [E:\MyProjects\CrossPlatform\Federmesser\fmapp5\FMApp5.csproj]
FMApp5 -> E:\MyProjects\CrossPlatform\Federmesser\fmapp5\bin\Debug\netcoreapp3.0\win-x64\FMApp5.dll
FMApp5 -> E:\MyProjects\CrossPlatform\Federmesser\fmapp5\bin\Debug\netcoreapp3.0\win-x64\FMApp5.Views.dll
FMApp5 -> E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\bin
E:\MyProjects\CrossPlatform\Federmesser\fmapp5>
Skip npm install, because node_modules directory exists in: E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\node_modules
Invoke electron.cmd - in dir: E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\node_modules.bin
Microsoft Windows [Version 10.0.17134.765]
(c) 2018 Microsoft Corporation. All rights reserved.
E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\node_modules.bin>electron.cmd "....\main.js"
stdout: info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5057
stdout: info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\bin


and silence...

Then I go to the folder and run FMApp5.exe manually - the same, no app.

What I do wrong?
I have attached my project
FMApp51.zip

Originally created by @win32nipuh on GitHub (May 21, 2019). Originally assigned to: @GregorBiswanger on GitHub. I have build the simple app as Gregor showed in youtube. It was built in VS2019, all is ok. But when I do >dotnet electronize start the app does not appear. That is all what I see: -------------- PS E:\MyProjects\CrossPlatform\Federmesser\fmapp5> electronize start Start Electron Desktop Application... Microsoft Windows [Version 10.0.17134.765] (c) 2018 Microsoft Corporation. All rights reserved. E:\MyProjects\CrossPlatform\Federmesser\fmapp5>dotnet publish -r win-x64 --output "E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\bin" Microsoft (R) Build Engine version 16.1.54-preview+gd004974104 for .NET Core Copyright (C) Microsoft Corporation. All rights reserved. Restore completed in 594.66 ms for E:\MyProjects\CrossPlatform\Federmesser\fmapp5\FMApp5.csproj. C:\Program Files\dotnet\sdk\3.0.100-preview4-011223\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [E:\MyProjects\CrossPlatform\Federmesser\fmapp5\FMApp5.csproj] FMApp5 -> E:\MyProjects\CrossPlatform\Federmesser\fmapp5\bin\Debug\netcoreapp3.0\win-x64\FMApp5.dll FMApp5 -> E:\MyProjects\CrossPlatform\Federmesser\fmapp5\bin\Debug\netcoreapp3.0\win-x64\FMApp5.Views.dll FMApp5 -> E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\bin\ E:\MyProjects\CrossPlatform\Federmesser\fmapp5> Skip npm install, because node_modules directory exists in: E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\node_modules Invoke electron.cmd - in dir: E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\node_modules\.bin Microsoft Windows [Version 10.0.17134.765] (c) 2018 Microsoft Corporation. All rights reserved. E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\node_modules\.bin>electron.cmd "..\..\main.js" stdout: info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:5057 stdout: info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: E:\MyProjects\CrossPlatform\Federmesser\fmapp5\obj\Host\bin -------------- and silence... Then I go to the folder and run FMApp5.exe manually - the same, no app. What I do wrong? I have attached my project [FMApp51.zip](https://github.com/ElectronNET/Electron.NET/files/3202647/FMApp51.zip)
claunia added the question label 2026-01-29 16:36:26 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (May 21, 2019):

Currently we have version 5.22.12 -> Support for Electron version 5, .NET Core 2.2, our release 12.

You used .NET Core 3 preview. Please try it again with an .NET Core 2.2 project.

@GregorBiswanger commented on GitHub (May 21, 2019): Currently we have version 5.22.12 -> Support for Electron version 5, .NET Core 2.2, our release 12. You used .NET Core 3 preview. Please try it again with an .NET Core 2.2 project.
Author
Owner

@win32nipuh commented on GitHub (May 22, 2019):

Thank you. I have build the new app (.NET Core 2.2), the same reaction, I run it but app does not appear.
WA1.zip
But VS 2019 show the output
[](1>------ Rebuild All started: Project: WA1, Configuration: Release Any CPU ------
1>C:\Program Files\dotnet\sdk\3.0.100-preview4-011223\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview

)

Then I have run:
PS E:\MyProjects\CrossPlatform\Federmesser\WA1> dotnet --list-sdks
2.1.507 [C:\Program Files\dotnet\sdk]
2.1.700-preview-009618 [C:\Program Files\dotnet\sdk]
2.1.800-preview-009677 [C:\Program Files\dotnet\sdk]
2.2.203 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
3.0.100-preview4-011223 [C:\Program Files\dotnet\sdk]
PS E:\MyProjects\CrossPlatform\Federmesser\WA1> dotnet --version
3.0.100-preview4-011223

May be some versions mix ? what I need to fix?

@win32nipuh commented on GitHub (May 22, 2019): Thank you. I have build the new app (.NET Core 2.2), the same reaction, I run it but app does not appear. [WA1.zip](https://github.com/ElectronNET/Electron.NET/files/3207409/WA1.zip) But VS 2019 show the output [](1>------ Rebuild All started: Project: WA1, Configuration: Release Any CPU ------ 1>C:\Program Files\dotnet\sdk\3.0.100-preview4-011223\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview ) Then I have run: [PS E:\MyProjects\CrossPlatform\Federmesser\WA1> dotnet --list-sdks 2.1.507 [C:\Program Files\dotnet\sdk] 2.1.700-preview-009618 [C:\Program Files\dotnet\sdk] 2.1.800-preview-009677 [C:\Program Files\dotnet\sdk] 2.2.203 [C:\Program Files\dotnet\sdk] 2.2.300 [C:\Program Files\dotnet\sdk] 3.0.100-preview4-011223 [C:\Program Files\dotnet\sdk] PS E:\MyProjects\CrossPlatform\Federmesser\WA1> dotnet --version 3.0.100-preview4-011223 ](url) May be some versions mix ? what I need to fix?
Author
Owner

@GregorBiswanger commented on GitHub (May 22, 2019):

Okay, I found your problem.

You need the UseElectron-WebHost extension in the program.cs:

public class Program
{
    public static void Main(string[] args)
    {
        CreateWebHostBuilder(args).Build().Run();
    }

    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
            .UseElectron(args)
            .UseStartup<Startup>();
}

And remove your fixed url-port assignment.

A tip, first set your application menu and then open the window:

public async void Bootstrap()
{
    var menu = new MenuItem[]
    {
        new MenuItem
        {
            Label = "File",
            Submenu = new MenuItem[]
            {
                new MenuItem
                {
                    Label = "Выход",
                    Click = () => { Electron.App.Exit(); }
                }
            }
        },
        new MenuItem
        {
            Label = "Инфа",
            Click = async () =>
            {
                await Electron.Dialog.ShowMessageBoxAsync("Go-go Pockemon!");
            }
        }
    };

    Electron.Menu.SetApplicationMenu(menu);

    var options = new BrowserWindowOptions
    {
        Show = false
    };

    var mainWindow = await Electron.WindowManager.CreateWindowAsync(options);
    mainWindow.OnReadyToShow += () => { mainWindow.Show(); };
}
@GregorBiswanger commented on GitHub (May 22, 2019): Okay, I found your problem. You need the **UseElectron**-WebHost extension in the **program.cs**: ``` public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseElectron(args) .UseStartup<Startup>(); } ``` And remove your fixed url-port assignment. A tip, first set your application menu and then open the window: ``` public async void Bootstrap() { var menu = new MenuItem[] { new MenuItem { Label = "File", Submenu = new MenuItem[] { new MenuItem { Label = "Выход", Click = () => { Electron.App.Exit(); } } } }, new MenuItem { Label = "Инфа", Click = async () => { await Electron.Dialog.ShowMessageBoxAsync("Go-go Pockemon!"); } } }; Electron.Menu.SetApplicationMenu(menu); var options = new BrowserWindowOptions { Show = false }; var mainWindow = await Electron.WindowManager.CreateWindowAsync(options); mainWindow.OnReadyToShow += () => { mainWindow.Show(); }; } ```
Author
Owner

@win32nipuh commented on GitHub (May 22, 2019):

Thank you Gregor! Sorry.
das ist mein Fehler :-)

@win32nipuh commented on GitHub (May 22, 2019): Thank you Gregor! Sorry. das ist mein Fehler :-)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#322