winform自动升级

1.client.config

<?xml version="1.0" encoding="utf-8"?>
<Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Enabled>true</Enabled>
  <ServerUrl>http://localhost/AutoUpdateFiles/Server.xml</ServerUrl>
  <UpdateFileList>
    <LocalFile path="Webcam.log" lastver="1.0.0.0">
      <ServerUrl />
    </LocalFile>
    <LocalFile path="WaterPress.txt" lastver="1.0.0.0">
      <ServerUrl />
    </LocalFile>
  </UpdateFileList>
</Config>

2.server.xml

<?xml version="1.0" encoding="us-ascii"?>
<updateFiles>
  <file path="Webcam.log" url="http://localhost/atoUpdateFiles/Webcam.log" size="184" lastver="1.0.0.0" />
  <file path="WaterPress.txt" url="http://localhost/autoUpdateFiles/WaterPress.txt" size="1632" lastver="1.0.0.0" />
</updateFiles>

3. 程序 使用AppUpdaterC.dll文件

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using AppUpdaterC;

namespace AutoUpdate
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AppUpdater updater = new AppUpdater();
            try
            {
                updater.Update();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            Application.Run(new Form1());
        }
    }
}

 

posted @ 2013-03-04 23:12  feidaochuanqing  阅读(191)  评论(0编辑  收藏  举报