当前位置: 移动技术网 > IT编程>开发语言>.net > [WPF 学习] 5. 版本升级

[WPF 学习] 5. 版本升级

2020年03月09日  | 移动技术网IT编程  | 我要评论

悍妾当家txt下载,车厘子价格,龙腾海啸txt

wpf core发布有个文件发布选项:生成单个文件,自动升级就比较方便了。

一、下载新版本程序,保存为...exe~,并运行

    process currentprocess = process.getcurrentprocess();
            
    file.writeallbytes(currentprocess.mainmodule.filename + "~", buffer);
    process p = new process();
    p.startinfo.filename = path.combine(pathdesktop, filename);
    p.startinfo.useshellexecute = false;
    p.start();

二、替换老版本并运行

                if (currentprocess.mainmodule.filename.endswith("~"))
                {
                    file.copy(currentprocess.mainmodule.filename, currentprocess.mainmodule.filename.trimend('~'), true);
                    process p = new process();
                    p.startinfo.filename = currentprocess.mainmodule.filename.trimend('~');
                    p.startinfo.useshellexecute = false;
                    p.start();
                    return;
                }

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网