![AutoUpdater.NET](Logo/Horizontal.png)
[![Build status](https://ci.appveyor.com/api/projects/status/yng987o7dauk9gqc?svg=true)](https://ci.appveyor.com/project/ravibpatel/autoupdater-net) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](http://paypal.me/rbsoft)
AutoUpdater.NET is a class library that allows .NET developers to easily add auto update functionality to their classic desktop application projects.
# The NuGet Package [![NuGet](https://img.shields.io/nuget/v/Autoupdater.NET.Official.svg)](https://www.nuget.org/packages/Autoupdater.NET.Official/) [![NuGet](https://img.shields.io/nuget/dt/Autoupdater.NET.Official.svg)](https://www.nuget.org/packages/Autoupdater.NET.Official/)
PM> Install-Package Autoupdater.NET.Official
## How it works
AutoUpdater.NET downloads the XML file containing update information from your server. It uses this XML file to get the information about the latest version of the software. If latest version of the software is greater then current version of the software installed on User's PC then AutoUpdater.NET shows update dialog to the user. If user press the update button to update the software then It downloads the update file (Installer) from URL provided in XML file and executes the installer file it just downloaded. It is a job of installer after this point to carry out the update. If you provide zip file URL instead of installer then AutoUpdater.NET will extract the contents of zip file to application directory.
## Using the code
### XML file
AutoUpdater.NET uses XML file located on a server to get the release information about the latest version of the software. You need to create XML file like below and then you need to upload it to your server.
````xml
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.0.0.0</version>
<url>http://rbsoft.org/downloads/AutoUpdaterTest.zip</url>
<changelog>https://github.com/ravibpatel/AutoUpdater.NET/releases</changelog>
<mandatory>false</mandatory>
</item>
````
There are two things you need to provide in XML file as you can see above.
* version (Required) : You need to provide latest version of the application between version tags. Version should be in X.X.X.X format.
* url (Required): You need to provide URL of the latest version installer file or zip file between url tags. AutoUpdater.NET downloads the file provided here and install it when user press the Update button.
* changelog (Optional): You need to provide URL of the change log of your application between changelog tags. If you don't provide the URL of the changelog then update dialog won't show the change log.
* mandatory (Optional): You can set this to true if you don't want user to skip this version. This will ignore Remind Later and Skip options and hide both Skip and Remind Later button on update dialog. You can provide mode attribute to change the behaviour of the mandatory flag. If you provide "1" as the value of mode attribute then it will also hide the Close button on update dialog. If you provide "2" as the value of mode attribute then it will skip the update dialog and start downloading and updating application automatically.
````xml
<mandatory mode="2">true</mandatory>
````
* args (Optional): You can provide command line arguments for Installer between this tag. You can include %path% with your command line arguments, it will be replaced by path of the directory where currently executing application resides.
* checksum (Optional): You can provide the checksum for the update file between this tag. If you do this AutoUpdater.NET will compare the checksum of the downloaded file before executing the update process to check the integrity of the file. You can provide algorithm attribute in the checksum tag to specify which algorithm should be used to generate the checksum of the downloaded file. Currently, MD5, SHA1, SHA256, SHA384, and SHA512 are supported.
````xml
<checksum algorithm="MD5">Update file Checksum</checksum>
````
### Adding one line to make it work
After you done creating and uploading XML file, It is very easy to add a auto update functionality to your application. First you need to add following line at the top of your form.
````csharp
using AutoUpdaterDotNET;
````
Now you just need to add following line to your main form constructor or in Form_Load event. You can add this line anywhere you like. If you don't like to check for update when application starts then you can create a Check for update button and add this line to Button_Click event.
````csharp
AutoUpdater.Start("http://rbsoft.org/updates/AutoUpdaterTest.xml");
````
Start method of AutoUpdater class takes URL of the XML file you uploaded to server as a parameter.
AutoUpdater.Start should be called from UI thread.
### Current version detection
AutoUpdater.NET uses Assembly version to determine the current version of the application. You can update it by going to Properties of the project as shown in following screenshot.
![How to change assembly version of your .NET application?](https://rbsoft.org/images/assembly-version.png)
Version specified in XML file should be higher than Assembly version to trigger the update.
If you want to provide your own Assembly then you can do it by providing second argument of Start method as shown below.
````csharp
AutoUpdater.Start("http://rbsoft.org/updates/AutoUpdaterTest.xml", myAssembly);
````
## Configuration Options
### Download Update file and XML using FTP
If you like to use ftp XML URL to check for updates or download the update file then you can provide you FTP credentials in alternative Start method as shown below.
````csharp
AutoUpdater.Start("ftp://rbsoft.org/updates/AutoUpdaterTest.xml", new NetworkCredential("FtpUserName", "FtpPassword"));
````
If you are using FTP download URL in the XML file then credentials provided here will be used to authenticate the request.
### Disable Skip Button
If you don't want to show Skip button on Update form then just add following line with above code.
````csharp
AutoUpdater.ShowSkipButton = false;
````
### Disable Remind Later Button
If you don't want to show Remind Later button on Update form then just add following line with above code.
````csharp
AutoUpdater.ShowRemindLaterButton = false;
````
### Ignore previous Remind Later or Skip settings
If you want to ignore previously set Remind Later and Skip settings then you can set Mandatory property to true. It will also hide Skip and Remind Later button. If you set Mandatory to true in code then value of Mandatory in your XML file will be ignored.
````csharp
AutoUpdater.Mandatory = true;
````
### Forced updates
You can enable forced updates by setting Mandatory property to true and setting UpdateMode to value of `Mode.Forced` or `Mode.ForcedDownload`. `Mode.Forced` option will hide Remind Later, Skip and Close buttons on the standard update dialog. `Mode.ForcedDownload` option will skip the standard update dialog and start downloading and updating the application without user interaction. `Mode.ForceDownload` option will also ignore value of OpenDownloadPage flag.
````csharp
AutoUpdater.Mandatory = true;
AutoUpdater.UpdateMode = Mode.Forced;
````
### Basic Authetication
You can provide Basic Authetication for XML, Update file and Change Log as shown in below code.
````csharp
BasicAuthentication basicAuthentication = new BasicAuthentication("myUserName", "myPassword");
AutoUpdater.BasicAuthXML = AutoUpdater.BasicAuthDownload = AutoUpdater.BasicAuthChangeLog = basicAuthentication;
````
### Set User-Agent for http web requests
Set the User-Agent string to be used for HTTP web requests so you can differentiate them in your web server request logs.
````csharp
AutoUpdater.HttpUserAgent = "AutoUpdater";
````
### Enable Error Reporting
You can turn on error reporting by adding below code. If you do this AutoUpdater.NET will show error message, if there is no update available or if it can't get to the XML file from we
没有合适的资源?快使用搜索试试~ 我知道了~
wpf 自动升级_WPF
共146个文件
resx:79个
cs:26个
png:13个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 8 浏览量
2022-09-21
03:02:45
上传
评论
收藏 606KB ZIP 举报
温馨提示
简单的自动升级,下载压缩包后,替换文件,可以根据比对版本号,控制是否升级
资源详情
资源评论
资源推荐
收起资源包目录
wpf 自动升级_WPF (146个子文件)
packages.config 219B
packages.config 170B
app.config 160B
app.config 160B
app.config 158B
ZipExtractor.exe.config 158B
packages.config 141B
AutoUpdater.cs 34KB
DownloadUpdateDialog.cs 11KB
Resources.Designer.cs 9KB
FormMain.cs 8KB
UpdateForm.cs 7KB
RemindLaterForm.Designer.cs 7KB
FormMain.cs 6KB
UpdateForm.Designer.cs 6KB
FormMain.Designer.cs 5KB
FormMain.Designer.cs 4KB
DownloadUpdateDialog.Designer.cs 4KB
Resources.Designer.cs 3KB
Resources.Designer.cs 3KB
Resources.Designer.cs 3KB
AssemblyInfo.cs 2KB
RemindLaterForm.cs 2KB
AssemblyInfo.cs 2KB
AssemblyInfo.cs 1KB
AssemblyInfo.cs 1KB
MainWindow.xaml.cs 1KB
Settings.Designer.cs 1KB
Settings.Designer.cs 1KB
Settings.Designer.cs 1KB
Program.cs 467B
Program.cs 455B
App.xaml.cs 304B
AutoUpdater.NET.csproj 17KB
ZipExtractor.csproj 7KB
AutoUpdaterTest.csproj 4KB
AutoUpdaterTestWPF.csproj 4KB
ZipExtractor.snk.enc 608B
AutoUpdater.NET.snk.enc 608B
ZipExtractor.exe 101KB
.gitignore 4KB
ZipExtractor.ico 69KB
LICENSE 1KB
app.manifest 3KB
app.manifest 3KB
README.md 15KB
Autoupdater.NET.Official.nuspec 1022B
Vertical.png 163KB
Horizontal.png 83KB
Logo.png 59KB
ZipExtractor.png 7KB
update.png 4KB
clock_go_32.png 3KB
clock_go1.png 3KB
download_32.png 1KB
download1.png 1KB
clock_go.png 965B
clock_play.png 959B
hand_point.png 620B
download.png 574B
UpdateForm.resx 65KB
DownloadUpdateDialog.resx 59KB
RemindLaterForm.resx 20KB
Resources.resx 9KB
RemindLaterForm.ar.resx 8KB
RemindLaterForm.ru.resx 7KB
RemindLaterForm.th.resx 7KB
Resources.th.resx 7KB
RemindLaterForm.tr.resx 7KB
RemindLaterForm.es.resx 7KB
RemindLaterForm.fr.resx 7KB
RemindLaterForm.it.resx 7KB
RemindLaterForm.ja-JP.resx 7KB
Resources.ja-JP.resx 7KB
RemindLaterForm.de.resx 7KB
RemindLaterForm.pl.resx 7KB
Resources.ru.resx 7KB
RemindLaterForm.sv.resx 7KB
RemindLaterForm.nl.resx 7KB
RemindLaterForm.da.resx 7KB
Resources.ar.resx 7KB
RemindLaterForm.ko.resx 7KB
RemindLaterForm.pt.resx 7KB
RemindLaterForm.zh.resx 7KB
RemindLaterForm.sk.resx 7KB
RemindLaterForm.zh-tw.resx 7KB
Resources.ko.resx 7KB
Resources.de.resx 7KB
Resources.fr.resx 7KB
Resources.es.resx 7KB
Resources.sk.resx 7KB
UpdateForm.ar.resx 7KB
Resources.it.resx 7KB
Resources.pl.resx 7KB
Resources.sv.resx 7KB
Resources.nl.resx 7KB
Resources.da.resx 7KB
UpdateForm.th.resx 7KB
UpdateForm.it.resx 7KB
UpdateForm.sk.resx 7KB
共 146 条
- 1
- 2
四散
- 粉丝: 49
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0