比如有一个a.exe,运行之后从某指定位置获得新的a.exe的内容,要求覆盖原有的文件,并且关闭当前的进程,重启一个新的a.exe进程,但是运行中的文件锁住了没法覆盖。请问有什么解决方案?

解决方案 »

  1.   

    这就是升级程序的用法启动一个进程A --> 执行另一进程B --> 结束程序A --> 用程序C替换程序A -->启动程序A -->退出程序B
      

  2.   

    给你找了几个版本自动更新的方法..希望对你有用...
    http://www.vjsdn.com/bbs/bbsTopicDetails.aspx?pid=611
      

  3.   

    结束程序 .启动升级程序替换程序数据
    http://topic.csdn.net/u/20090422/08/69f9713b-3982-4313-ab11-7fb6eefdcf93.html
      

  4.   

    http://www.codeproject.com/KB/vb/Auto_Update_Revisited.aspx 参考
      

  5.   

    验证版本        public class Version {
                public static int Verstion { get; set; }
                public static bool CheckVersion() {
                    string path = System.Configuration.ConfigurationManager.AppSettings[ "UpdatePath" ];
                    string version = System.Configuration.ConfigurationManager.AppSettings[ "Version" ];
                    if( !string.IsNullOrEmpty( path ) ) {
                        XmlDocument xml = new XmlDocument();
                        try {
                            xml.Load( path );
                            XmlNode node = xml.SelectSingleNode( "/version" );
                            if( node != null ) {
                                System.Configuration.ConfigurationManager.AppSettings[ "Version" ] = node.InnerText;
                                return node.InnerText != version;
                            }
                        } catch(Exception exp) {
                            Log.Error( exp );
                            return false;
                        }
                    }
                    return false;
                }
            }
      

  6.   

    不知道为什么用Application.ExitThread()突然退不出主程序了。