SharpUpdater is a bootstrap loader for adding automatic update capability to your windows desktop applicatons based on .NET framework.It is also a solution which provides a sample server program and a set of APIs for developers to extend from version 2.0 onwards.
1.How it works
Updater.exe download the latest release list config file from server,compare with the local release list, if local version out-of-date, the differential files downloaded from the server, and coverage to the local, and then start the main program.
2.The Service Side Configuration
To IIS7.5
1, Create a new IIS site.
2, Disable * dll handles mapping to allow dll file to download.
3, On this site to create a desktop program subdirectory, such as /demo/.
3.The Client Configuration
1,Include or reference SharpUpdater.Util.dll / Updater.exe. If you need a zip formated update package , also need to include ICSharpcode.SharpZipLib.dll / CnSharp.ZipUtil.dll
2,Add interoperability code to main program entrance for updater
private static void Main(string[] args)
{
if (args.Length == 0)
{
Process.Start("updater.exe");
Application.Exit();
return;
}
if (!args[0].StartsWith("ok"))
{
Application.Exit();
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
4.Package and Release
1,SharpPack
SharpPack is a VS2010 extension used to generate WinForm program and release list
Right-click the WinForm project, select Package and Publish command
Fill the fields of Release List
2,Upload ReleaseList.xml and folder '1.0.0.0' generated under bin/ directory to the server ~/Demo/ directory
3,SharpPack Config
ReleaseFilter.xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<deletefolders>^(log|_LogData|..publish)$</deletefolders>
<deletefiles>^(.</deletefiles>.pdb|..application|..manifest|..vshost..|[^\]+.xml)$
<excludefiles>^(Updater.exe|SharpUpdater.Util.dll|ICSharpcode.SharpZipLib.dll|CnSharp.ZipUtil.dll|ReleaseList.xml|.*\Updater.resources.dll)$</excludefiles>
</configuration>
<deletefolders> Folders to be deleted before packaged
<deletefiles> Files to be deleted before packaged
<excludefiles> Files to include in package, but exclude from the release list that the client does not need to update.File updater.exe and the DLL it referenced must be excluded.</excludefiles></deletefiles></deletefolders>
5.Extensibility
i) Extension for Updater
1,Implement CnSharp.Windows.Updater.Util.UpdateProxy.IUpdateProxy
In the SharpUpdater source code,we did not implement this interface, see CnSharp.Windows.Updater/Common.cs/Ln.14。Therefore, by default only show the update log of the current version; assume that the user upgrade from V1.0 to V1.4, you can only see V1.4 update log, can not see V1.1 ~ V1.3 . Developers can implement it own.
2,SharpUpdater source code based on MIT lisence,you can modify it freely.
ii) SharpPack
1,interface:IPublishProxy
This interface supports will publish information uploaded to the custom server, such as generating publish log.
2,interface:IVersionControl
This interface supports file version control, check out the version number in AssemblyInfo.cs facilitate SharpPack automatically update.