Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Does this library have the ability to NOT execute the executable? #229

Closed
pagner opened this issue Sep 21, 2021 · 4 comments
Closed
Labels

Comments

@pagner
Copy link

pagner commented Sep 21, 2021

Please correct me if I'm wrong but netsparkle seems like it is expecting an "installer" file to be downloaded and executed.

Is it possible to just download all the update files and restart the main program?

I would like to have a manifest (appcast) that may only contain a few new libraries, maybe some assets and of course the .exe, or dll (linux, mac)

.NET only requires a restart to consume the new files and "update". I don't need/want to build an "installer" that is executed by netsparkle.

I have done this in the past with a winforms app, but that was some time ago.

Is this possible with netsparkle? I didn't see any sort of hierarchal path tag in the appcast file for target files to be placed.

Thanks in advance

@Deadpikle
Copy link
Collaborator

Hi @pagner, thanks for your question!

Technically, this behavior isn't officially available. However, depending on your needs, you should be able to make it work by:

  1. Download a .zip file of your updates
  2. Override SparkleUpdater.RunDownloadedInstaller(string downloadFilePath) (https://github.com/NetSparkleUpdater/NetSparkle/blob/develop/src/NetSparkle/SparkleUpdater.cs#L1290) with your own implementation that does the update for you based on the file in the zip.

How you then update the files when your executable is currently running (an already tricky thing -- you can't exactly overwrite an executable that's currently running) would be left up to you. Ideally, we'd support zips on Windows (see #183), but that's a little tricky to support in a batch script.

In other words, it's technically possible, but you're going to have to do much of the legwork for the actual updating. It'd be great if we supported actual application updating out of the box, sort of like Sparkle on macOS, but doing that in a cross-platform way that works well and such would be...very difficult, and it is outside the scope of my time or energy right now with my limited time. (Contributions always welcome, of course.)

If you decide to implement this and want to contribute back, that'd be great!

@Deadpikle
Copy link
Collaborator

In other words:

  • On macOS, you can just use zip/.tar.gz support to avoid using an installer
  • On Linux, same story as macOS
  • On Windows, because we don't have Windows batch zip/.tar.gz support pre-Windows 10 17063 (see CustomUnzipCommandTemplate implementation, for zipped distributions on Windows #219), right now, Windows requires an installer or other executable of some type. If we were able to add .zip/.tar.gz support to all supported versions of Windows, we might be able to avoid using an installer there.

@Deadpikle Deadpikle reopened this Oct 1, 2021
@pagner
Copy link
Author

pagner commented Oct 1, 2021

Hi @Deadpikle,
Thanks for the response. I ended up writing my own just as you described. I am on .net 5 (avalonia app)

What I did was create an avalonia app as my "Updater". In my main program I check a json file hosted on my server. If the version is newer I launch the updater from my main program and then exit the main program.

The updater UI is a small window with a progress bar and text. It downloads the zip file and extracts it to a temp directory using WebClient and System.IO.Compression.Zipfile. Once extracted I iterate through the directories and create a manifest. Working from the manifest I then delete the "old" files and move the update files to their locations. I then delete the temp directory, launch the main app and exit the updater.

It works well (tested on Windows, Mac and Linux). This is the same approach I used many moons ago, although I was using XML instead of json back then and I was only supporting Windows.

Technically my "Updater" is an installer.. lol

Thanks again!

@Deadpikle
Copy link
Collaborator

You're welcome! I'll go ahead and close this since it is resolved. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants