Skip to content

pengyouak/DotNetAutoUpdater

Repository files navigation

自动更新组件


截图

image

image

image

XML 配置

<?xml version="1.0" encoding="utf-8"?>
<UpdateOption xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Version>1.1.1.1</Version>
  <ServerUrl>http://xxx.xxx.xxx/</ServerUrl>
  <UpdateMode>2</UpdateMode>
  <ChangeLog></ChangeLog>
  <UpdateItems>
    <UpdateItem>
      <Version>1.0.0.0</Version>
      <Path>DotNetAutoUpdater.dll</Path>
    </UpdateItem>
    </UpdateItem>
    <UpdateItem>
      <Version>1.0.0.0</Version>
      <Path>b/DotNetAutoUpdaterTest.exe</Path>
    </UpdateItem>
    </UpdateItem>
  </UpdateItems>
</UpdateOption>

UpdateMode

  • 0: 提示更新
  • 1: 提示并显示更新详情
  • 2: 强制更新

使用

var updaterPath = "AutoUpdater.exe";
if (System.IO.File.Exists(updaterPath))
{
    string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, updaterPath);
    var update = System.Diagnostics.Process.Start(path, $@"-u http://xxx/update.xml -p {System.Diagnostics.Process.GetCurrentProcess().Id} -a ""{System.Windows.Forms.Application.ExecutablePath}""");
    update.WaitForExit();
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages