How to use Auto updater ? #405

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

Originally created by @giorgosavramopoulos on GitHub (Nov 2, 2019).

I understand that this is not the place to ask questions, but i cannot understand how to configure Electron.NET to properly use the auto updater feature.
How to setup the remote repo where the update will be?
If you cannot answer here, please point to the right direction.. :)
Thanks!

Originally created by @giorgosavramopoulos on GitHub (Nov 2, 2019). I understand that this is not the place to ask questions, but i cannot understand how to configure Electron.NET to properly use the auto updater feature. How to setup the remote repo where the update will be? If you cannot answer here, please point to the right direction.. :) Thanks!
claunia added the question label 2026-01-29 16:38:45 +00:00
Author
Owner

@giorgosavramopoulos commented on GitHub (Nov 4, 2019):

OK, i figured it out so i though posting my answer in case someone else is interested..
So I wanted to see how to configure the updater for updating through a simple http server.
In electron.manifest.json i added this configuration inside build params:

"build": {
...,
"publish": {
"provider": "generic",
"url": "http://localhost:82",
"channel": "latest"
}
}

and i set up a local http server in iis on port 82 to serve files (need to include .yml in the mime types).
Inside the server path i put the files:

  • application.exe
  • application.exe.blockmap
  • latest.yml

Then when using eg. Electron.AutoUpdater.CheckForUpdatesAsync() it finds the files and tries to update.

@giorgosavramopoulos commented on GitHub (Nov 4, 2019): OK, i figured it out so i though posting my answer in case someone else is interested.. So I wanted to see how to configure the updater for updating through a simple http server. In electron.manifest.json i added this configuration inside build params: "build": { ..., "publish": { "provider": "generic", "url": "http://localhost:82", "channel": "latest" } } and i set up a local http server in iis on port 82 to serve files (need to include .yml in the mime types). Inside the server path i put the files: - application.exe - application.exe.blockmap - latest.yml Then when using eg. Electron.AutoUpdater.CheckForUpdatesAsync() it finds the files and tries to update.
Author
Owner

@simonmurrell commented on GitHub (Nov 9, 2019):

OK, i figured it out so i though posting my answer in case someone else is interested..
So I wanted to see how to configure the updater for updating through a simple http server.
In electron.manifest.json i added this configuration inside build params:

"build": {
...,
"publish": {
"provider": "generic",
"url": "http://localhost:82",
"channel": "latest"
}
}

and i set up a local http server in iis on port 82 to serve files (need to include .yml in the mime types).
Inside the server path i put the files:

  • application.exe
  • application.exe.blockmap
  • latest.yml

Then when using eg. Electron.AutoUpdater.CheckForUpdatesAsync() it finds the files and tries to update.

Hello

I tried this inside my build params of the electron.manifest.json file. It keeps looking at a local file in the obj\Host called dev_app_update.yml. It is not looking on the remote server I specified. I opened up Fiddler to see if it was making any http requests to the server. I am running the latest version of Electron.NET.

Regards,
Simon

@simonmurrell commented on GitHub (Nov 9, 2019): > OK, i figured it out so i though posting my answer in case someone else is interested.. > So I wanted to see how to configure the updater for updating through a simple http server. > In electron.manifest.json i added this configuration inside build params: > > "build": { > ..., > "publish": { > "provider": "generic", > "url": "http://localhost:82", > "channel": "latest" > } > } > > and i set up a local http server in iis on port 82 to serve files (need to include .yml in the mime types). > Inside the server path i put the files: > > * application.exe > * application.exe.blockmap > * latest.yml > > Then when using eg. Electron.AutoUpdater.CheckForUpdatesAsync() it finds the files and tries to update. Hello I tried this inside my build params of the electron.manifest.json file. It keeps looking at a local file in the obj\Host called dev_app_update.yml. It is not looking on the remote server I specified. I opened up Fiddler to see if it was making any http requests to the server. I am running the latest version of Electron.NET. Regards, Simon
Author
Owner

@giorgosavramopoulos commented on GitHub (Nov 9, 2019):

Hi Simon,

Yes i forgor to mention that it does not work when running for debugging(electronize start..). You need to build for release (electronize build...)
Then under bin/Desktop will be the files you need to put in the http server and to see the updater working you either install the app and run it (i run it through cmd to see the logs) or run the exe under bin\Desktop\win-ia32-unpacked (this should work too i am not sure).
Under the folder bin\Desktop\win-ia32-unpacked\resources you should now see a app-update.yml file that should contain the info you have specified.

@giorgosavramopoulos commented on GitHub (Nov 9, 2019): Hi Simon, Yes i forgor to mention that it does not work when running for debugging(electronize start..). You need to build for release (electronize build...) Then under bin/Desktop will be the files you need to put in the http server and to see the updater working you either install the app and run it (i run it through cmd to see the logs) or run the exe under bin\Desktop\win-ia32-unpacked (this should work too i am not sure). Under the folder bin\Desktop\win-ia32-unpacked\resources you should now see a app-update.yml file that should contain the info you have specified.
Author
Owner

@simonmurrell commented on GitHub (Nov 9, 2019):

Do you prompt the user to download it if an update is found or do you automatically download it? Does that method prompt the user

@simonmurrell commented on GitHub (Nov 9, 2019): Do you prompt the user to download it if an update is found or do you automatically download it? Does that method prompt the user
Author
Owner

@giorgosavramopoulos commented on GitHub (Nov 9, 2019):

If you use it without any other AutoUpdater configuration it will download the update too and install it

@giorgosavramopoulos commented on GitHub (Nov 9, 2019): If you use it without any other AutoUpdater configuration it will download the update too and install it
Author
Owner

@simonmurrell commented on GitHub (Nov 9, 2019):

I see it is the base Electron.NET update information and not my application. Seems like this feature has not been implemented 100% yet...

@simonmurrell commented on GitHub (Nov 9, 2019): I see it is the base Electron.NET update information and not my application. Seems like this feature has not been implemented 100% yet...
Author
Owner

@giorgosavramopoulos commented on GitHub (Nov 9, 2019):

where do you see that? i got it working the way i said above..

@giorgosavramopoulos commented on GitHub (Nov 9, 2019): where do you see that? i got it working the way i said above..
Author
Owner

@simonmurrell commented on GitHub (Nov 9, 2019):

I rebuilt it once again and now I see my info. Thanks. Let me see where this goes ;)

@simonmurrell commented on GitHub (Nov 9, 2019): I rebuilt it once again and now I see my info. Thanks. Let me see where this goes ;)
Author
Owner

@simonmurrell commented on GitHub (Nov 9, 2019):

Ok I see it is processing now. I added the YML file to the mime types. Do you then prompt the user to download or force it on them.

@simonmurrell commented on GitHub (Nov 9, 2019): Ok I see it is processing now. I added the YML file to the mime types. Do you then prompt the user to download or force it on them.
Author
Owner

@giorgosavramopoulos commented on GitHub (Nov 9, 2019):

For that, it depends on what you want to do. I show a message that there is an update available and will be installed once the app quits and use QuitAndInstall method. You can see the available methods if you go inside AutoUpdater Class:
https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.API/AutoUpdater.cs

@giorgosavramopoulos commented on GitHub (Nov 9, 2019): For that, it depends on what you want to do. I show a message that there is an update available and will be installed once the app quits and use QuitAndInstall method. You can see the available methods if you go inside AutoUpdater Class: https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.API/AutoUpdater.cs
Author
Owner

@OmiCron07 commented on GitHub (Dec 13, 2019):

OK, i figured it out so i though posting my answer in case someone else is interested..
So I wanted to see how to configure the updater for updating through a simple http server.
In electron.manifest.json i added this configuration inside build params:

"build": {
...,
"publish": {
"provider": "generic",
"url": "http://localhost:82",
"channel": "latest"
}
}

and i set up a local http server in iis on port 82 to serve files (need to include .yml in the mime types).
Inside the server path i put the files:

* application.exe

* application.exe.blockmap

* latest.yml

Then when using eg. Electron.AutoUpdater.CheckForUpdatesAsync() it finds the files and tries to update.

Kudo for that! And it works with an Azure blob storage.

@OmiCron07 commented on GitHub (Dec 13, 2019): > > > OK, i figured it out so i though posting my answer in case someone else is interested.. > So I wanted to see how to configure the updater for updating through a simple http server. > In electron.manifest.json i added this configuration inside build params: > > "build": { > ..., > "publish": { > "provider": "generic", > "url": "http://localhost:82", > "channel": "latest" > } > } > > and i set up a local http server in iis on port 82 to serve files (need to include .yml in the mime types). > Inside the server path i put the files: > > * application.exe > > * application.exe.blockmap > > * latest.yml > > > Then when using eg. Electron.AutoUpdater.CheckForUpdatesAsync() it finds the files and tries to update. Kudo for that! And it works with an Azure blob storage.
Author
Owner

@GregorBiswanger commented on GitHub (May 10, 2020):

Please have a look at electron-builder. You can find the configuration for this under the new electron.manifest.json file at "build".

https://www.electron.build/auto-update

We have an sample in our API Demo App too:
https://github.com/ElectronNET/electron.net-api-demos

@GregorBiswanger commented on GitHub (May 10, 2020): Please have a look at electron-builder. You can find the configuration for this under the new `electron.manifest.json` file at `"build"`. https://www.electron.build/auto-update We have an sample in our API Demo App too: https://github.com/ElectronNET/electron.net-api-demos
Author
Owner

@sachinmakhre commented on GitHub (Jul 16, 2021):

Please have a look at electron-builder. You can find the configuration for this under the new electron.manifest.json file at "build".

https://www.electron.build/auto-update

We have an sample in our API Demo App too:
https://github.com/ElectronNET/electron.net-api-demos

hi i am very new to electron and node ,unable to implement auto update please help...

@sachinmakhre commented on GitHub (Jul 16, 2021): > Please have a look at electron-builder. You can find the configuration for this under the new `electron.manifest.json` file at `"build"`. > > https://www.electron.build/auto-update > > We have an sample in our API Demo App too: > https://github.com/ElectronNET/electron.net-api-demos hi i am very new to electron and node ,unable to implement auto update please help...
Author
Owner

@GregorBiswanger commented on GitHub (Jul 16, 2021):

@sachinmakhre Please refer to the instructions on the Internet for electron builder - Auto Update. This can be used 1:1 with Electron.NET.

@GregorBiswanger commented on GitHub (Jul 16, 2021): @sachinmakhre Please refer to the instructions on the Internet for electron builder - Auto Update. This can be used 1:1 with Electron.NET.
Author
Owner

@sachinmakhre commented on GitHub (Jul 16, 2021):

@sachinmakhre Please refer to the instructions on the Internet for electron builder - Auto Update. This can be used 1:1 with Electron.NET.

thanks Gregor ! replying in very short time
still yet no luck , i am trying .NET 5 server blazer app with electron.net Api
no function is working ,require return undefine, where to write main process function ,
it will be great help if you a short demo on .NET 5 server blazer app this will help me understand where to write render and main process . i wish to bring your notice , we are not using MVC

@sachinmakhre commented on GitHub (Jul 16, 2021): > @sachinmakhre Please refer to the instructions on the Internet for electron builder - Auto Update. This can be used 1:1 with Electron.NET. thanks Gregor ! replying in very short time still yet no luck , i am trying .NET 5 server blazer app with electron.net Api no function is working ,require return undefine, where to write main process function , it will be great help if you a short demo on .NET 5 server blazer app this will help me understand where to write render and main process . **i wish to bring your notice , we are not using MVC**
Author
Owner

@MSiffert commented on GitHub (Oct 9, 2021):

@sachinmakhre You could do something like this.

protected override async Task OnAfterRenderAsync(bool firstRender)
{
    if (firstRender)
    {
        ElectronNET.API.Electron.AutoUpdater.OnUpdateNotAvailable += async e => await OnUpdateNotAvailable(e);
        ElectronNET.API.Electron.AutoUpdater.OnUpdateAvailable += async e => await OnUpdateAvailable(e);
        ElectronNET.API.Electron.AutoUpdater.OnError += async e => await OnInstallUpdateFailed(e);
    }
}

protected async Task CheckForUpdates()
{
    ElectronNET.API.Electron.AutoUpdater.AutoDownload = false;
    await ElectronNET.API.Electron.AutoUpdater.CheckForUpdatesAndNotifyAsync();
}

private async Task OnUpdateAvailable(UpdateInfo updateInfo)
{
    var message = $"PRODUCT {updateInfo.Version} is available.";
    var result = await ElectronService.ShowMessageBox(new MessageBoxOptions(message)
    {
        Title = "Updates",
        Type = MessageBoxType.info,
        NoLink = true,
        Buttons = new[]
        {
            "Update and restart application",
            "Update and install on app quit",
            "Cancel"
        }
    });
    
    if (result.Response == 0)
    {
        await ElectronNET.API.Electron.AutoUpdater.DownloadUpdateAsync();
        ElectronNET.API.Electron.AutoUpdater.QuitAndInstall();
    }
                        
    if (result.Response == 1)
    {
        ElectronNET.API.Electron.AutoUpdater.AutoInstallOnAppQuit = true;
        await ElectronNET.API.Electron.AutoUpdater.DownloadUpdateAsync();
    }
}

private async Task OnUpdateNotAvailable(UpdateInfo updateInfo)
{
    var message = "There is no update available.";
    await ElectronService.ShowMessageBox(new MessageBoxOptions(message)
    {
        Title = "Updates",
        Type = MessageBoxType.info,
        NoLink = true
    });
}

private async Task OnInstallUpdateFailed(string error)
{
    var message = $"Failed to install update. {error}";
    await ElectronService.ShowMessageBox(new MessageBoxOptions(message)
    {
        Title = "Updates",
        Type = MessageBoxType.info,
        NoLink = true
    });
}

This examples assumes that you have set up the update-server correctly as described above.

@MSiffert commented on GitHub (Oct 9, 2021): @sachinmakhre You could do something like this. ``` protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { ElectronNET.API.Electron.AutoUpdater.OnUpdateNotAvailable += async e => await OnUpdateNotAvailable(e); ElectronNET.API.Electron.AutoUpdater.OnUpdateAvailable += async e => await OnUpdateAvailable(e); ElectronNET.API.Electron.AutoUpdater.OnError += async e => await OnInstallUpdateFailed(e); } } protected async Task CheckForUpdates() { ElectronNET.API.Electron.AutoUpdater.AutoDownload = false; await ElectronNET.API.Electron.AutoUpdater.CheckForUpdatesAndNotifyAsync(); } private async Task OnUpdateAvailable(UpdateInfo updateInfo) { var message = $"PRODUCT {updateInfo.Version} is available."; var result = await ElectronService.ShowMessageBox(new MessageBoxOptions(message) { Title = "Updates", Type = MessageBoxType.info, NoLink = true, Buttons = new[] { "Update and restart application", "Update and install on app quit", "Cancel" } }); if (result.Response == 0) { await ElectronNET.API.Electron.AutoUpdater.DownloadUpdateAsync(); ElectronNET.API.Electron.AutoUpdater.QuitAndInstall(); } if (result.Response == 1) { ElectronNET.API.Electron.AutoUpdater.AutoInstallOnAppQuit = true; await ElectronNET.API.Electron.AutoUpdater.DownloadUpdateAsync(); } } private async Task OnUpdateNotAvailable(UpdateInfo updateInfo) { var message = "There is no update available."; await ElectronService.ShowMessageBox(new MessageBoxOptions(message) { Title = "Updates", Type = MessageBoxType.info, NoLink = true }); } private async Task OnInstallUpdateFailed(string error) { var message = $"Failed to install update. {error}"; await ElectronService.ShowMessageBox(new MessageBoxOptions(message) { Title = "Updates", Type = MessageBoxType.info, NoLink = true }); } ``` This examples assumes that you have set up the update-server correctly as described above.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#405