39

On the Mac there's a really nice library called Sparkle that programs can use to implement the checking/install functionality for auto-updates.

Is there anything similar out there for .NET? Or just regular Win32?

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
Andrew Grant
  • 58,260
  • 22
  • 130
  • 143
  • 1
    You can try Autoupdater.NET from [codeplex](http://autoupdaterdotnet.codeplex.com/) I developed it my self and it works very well in my applications. You just have to add one line in your code and its done. – Ravi Patel Jun 10 '12 at 04:42

12 Answers12

28

ClickOnce has its own security limitations (understandbly so). If you want the full power and control of a Windows application then go with the .NET application updater component. It works like a charm and has even been used by Microsoft internally for their .NET based game (I don't remember the game name though).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Raj
  • 6,810
  • 6
  • 48
  • 56
  • 2
    The name of the game is Terrerium - http://www.codeplex.com/terrarium2 – kdmurray Jan 26 '10 at 04:56
  • 8
    The link is dead :( – Alex from Jitbit Nov 20 '12 at 08:55
  • The link now redirects to a general Windows_Presentation_Foundation (WPF) page. Should it be *[Updater Application Block](http://msdn.microsoft.com/en-us/library/ff650611.aspx)*?: "The Updater Application Block is a .NET Framework component that you can use to detect, download, and apply client application updates deployed in a central location." – Peter Mortensen Jul 05 '13 at 07:08
  • 1
    @Peter - http://web.archive.org/web/20110113214801/http://windowsclient.net/articles/appupdater.aspx – transistor1 Jul 07 '13 at 20:35
15

Let me start by saying we offer a complete updating solution which includes:

wyUpdate handles all of the Vista/Windows 7 UAC problems and all the file permission problems that inevitably pop up when you're trying to update complex software.

That being said, if you want to build your own updater here are some tips:

Building your own updater

A good place to start is the wyUpdate C# source code I mentioned above. You can cannibalize it and use it for your own purposes. Some of the algorithms it contains:

  • Full Windows Vista / Windows 7 UAC support
  • Ability for limited users to check and then update if they have credentials
  • Support for wonky corporate inernet. (If you've ever worked with a corporation this is a real problem).
  • Quick extracting, patching, and installing of files.
  • Registry support.
  • Roll back files & registry on error or cancellation by the user
  • Self-update (no files left behind)

We also have the file specifications here.

Automatic updating

Since being automatic is a requirement let me tell you how we do it with our AutomaticUpdater control.

We use named pipes to communicate between the standalone updater (wyUpdate) and the Automatic Updater control sitting on your program's form. wyUpdate reports progress to the Automatic Updater, and the Automatic Updater can tell wyUpdate to cancel progress, to start downloading, start extracting, etc.

This keeps the updater separate from your application.

In fact, the exact named pipes C# code we use is included in an article I wrote a little while back: Multi-process C# app like Google Chrome.

Wyatt O'Day
  • 1,893
  • 1
  • 28
  • 29
  • It says [here](http://wyday.com/wybuild/help/automatic-updates/using-automatic-updater-in-wpf.php) that "You need wyBuild to use the AutomaticUpdater control." Is it possible to use AutomaticUpdater without buying wyBuild? – funseiki Sep 05 '12 at 20:38
  • Yes, but you have to manually piece together your updates (which is a big hassle, but certainly possible if you don't want to buy wyBuild). – Wyatt O'Day Sep 05 '12 at 20:55
10

ClickOnce is my preferred method. It has some warts, but it comes with Visual Studio and works reasonably well.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447
  • Thanks for your comment. I was under the impression that ClickOnce was only for non-installable per-user applications? – Andrew Grant Mar 27 '09 at 22:21
  • It's only for per user apps... – Tarnay Kálmán Mar 27 '09 at 22:34
  • 1
    No, it is primarily for installed apps as well. It can be quite flexible if you take the time to learn it. – Jonathan Allen Mar 31 '09 at 05:45
  • 10
    per user only! "If you need to install / upgrade for all users on a PC, Clickonce is not an option. Clickonce is meant for installing an application for a single user without administrative rights." See: http://stackoverflow.com/questions/276916/click-once-all-users/399031#399031 – Tarnay Kálmán Aug 16 '09 at 15:28
6

I just went through the process of doing this and used NetSparkle.

It worked as advertised for a Windows Forms application with an MSI installer that overwrites the previous version. I'm very glad I found it too -- I was about to roll my own. Am I the only one making really simple .NET applications? Mostly everything I looked at seemed like a complete overkill.

Lou Zell
  • 5,255
  • 3
  • 28
  • 23
6

ClickOnce is heavily used, but you can do what I did for a large application and try these:

I tinkered with the logic a bit and built what I thought was a better XML update file. Now, when I need to update the clients, I just post the new EXE files or DLL files and set the correct versions in the public XML file. My application detects the newer versions if it is older and updates itself. If you are doing this on Windows Vista, you need to prompt for administrator permissions so that Program Files can be written to (if you install there).

You can also easily convert this to C# using C#/VB.NET Converter.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jeremy Sena
  • 208
  • 1
  • 2
  • 9
5

I didn't try NetSparkle yet (I will later), but it seems it's what you're looking for.

NetSparkle is an easy-to-use software update framework for .NET developers on Windows, Mac or Linux. It was inspired by the Sparkle project for Cocoa developers and the WinSparkle project (a Win32 port).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Eric Bole-Feysot
  • 13,949
  • 7
  • 47
  • 53
3

I think WyBuild is good Sparkle alternative )

2

We investigated a handful of options and decided to use AppLife Update. AppLife Update can quickly and easily add auto update functionality for your .NET applications, but it is also flexible because of its comprehensive API.

See the full list of features and some demo videos on their website.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kobus Smit
  • 1,775
  • 2
  • 18
  • 30
2

DotNetAutoUpdate

I've implemented a library to do this called DotNetAutoUpdate (original name eh?). It aims to be:

  • Simple to use
  • Simple to setup
  • Secure
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Luke Quinane
  • 16,447
  • 13
  • 69
  • 88
2

Here's an open-source solution I wrote to address specific needs we had for WinForms and WPF apps. The general idea is to have the greatest flexibility, at the lowest overhead possible.

So, integration is super-easy, and the library does pretty much everything for you, including synchronizing operations. It is also highly flexible, and lets you determine what tasks to execute and on what conditions - you make the rules (or use some that are there already). Last but not least is the support for any update source (web, BitTorrent, etc) and any feed format - whatever is not implemented you can just write for yourself.

Cold updates (requiring an application restart) are also supported, and done automatically unless "hot-swap" is specified for the task.

This boils down to one DLL, less than 70kb in size.

More details at http://www.code972.com/blog/2010/08/nappupdate-application-auto-update-framework-for-dotnet/

Code is at http://github.com/synhershko/NAppUpdate (Licensed under the Apache 2.0 license)

I plan on extending it more when I get some more time, but honestly you should be able to quickly enhance it yourself for whatever it currently doesn't support.

Michael Mrozek
  • 169,610
  • 28
  • 168
  • 175
synhershko
  • 4,472
  • 1
  • 30
  • 37
2

There is a really nice utility called Updater. It looks like it is written in C or C++. I have been able to configure the XML files and load them to the production server, and then I can have the Updater Run and check the XML file for a different version and download a new update install package that I built using the Nullsoft Scriptable Install System (NSIS).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
spinner_den_g
  • 941
  • 1
  • 8
  • 14
-1

For updating .Net client applications, take a look at AppLife Update. It is very flexible, extensible and customizable.

Disclaimer - I am associated with AppLife Update.