Wont create a menu item when using Blazor? #218

Closed
opened 2026-01-29 16:34:08 +00:00 by claunia · 1 comment
Owner

Originally created by @CosDevelopment on GitHub (Oct 16, 2018).

Originally assigned to: @GregorBiswanger on GitHub.

Hi, Ive tried multiple times to add a menustrip to my application ( default blazor application, just telling it to start with Electron.

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {

            
            Task.Run(async () => {
                 var options = new BrowserWindowOptions { Show = true}; 
                 Electron.Menu.SetApplicationMenu(new MenuItem[] { new MenuItem { Label = "Exit" }}); 
                 await Electron.WindowManager.CreateWindowAsync(options); 
                 });
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default", template: "{controller}/{action}/{id?}");
            });

            app.UseBlazor<Client.Program>();

        }

Why wont my menu strip show? I am using Ubuntu Linux as my development environment and VSCode as my text editor, with the dotnet command line compiler.

Originally created by @CosDevelopment on GitHub (Oct 16, 2018). Originally assigned to: @GregorBiswanger on GitHub. Hi, Ive tried multiple times to add a menustrip to my application ( default blazor application, just telling it to start with Electron. ```C# public void Configure(IApplicationBuilder app, IHostingEnvironment env) { Task.Run(async () => { var options = new BrowserWindowOptions { Show = true}; Electron.Menu.SetApplicationMenu(new MenuItem[] { new MenuItem { Label = "Exit" }}); await Electron.WindowManager.CreateWindowAsync(options); }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(routes => { routes.MapRoute(name: "default", template: "{controller}/{action}/{id?}"); }); app.UseBlazor<Client.Program>(); } ``` Why wont my menu strip show? I am using Ubuntu Linux as my development environment and VSCode as my text editor, with the dotnet command line compiler.
claunia added the question label 2026-01-29 16:34:08 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Jan 3, 2019):

Your code works on my Windows 10 - but I tested it without blazor.
Do you can test it with a non-blazor project?

@GregorBiswanger commented on GitHub (Jan 3, 2019): Your code works on my Windows 10 - but I tested it without blazor. Do you can test it with a non-blazor project?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#218