更新C#应用程序替换.exe文件 [英] Update C# application replace .exe file

查看:524
本文介绍了更新C#应用程序替换.exe文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设法让我的应用程序使用服务器上的 WebService 检查更新,它将查看是否有任何更新。但是我现在面临的真正问题是,我不知道如何下载应用程序的 .exe 的较新版本并替换当前正在运行的版本。

I have managed to get my application checking for updates with a WebService on my server and It will see if any update is there to be made. But the real problem I am facing right now is that I have no idea how to download the newer version of .exe of my application and replace the current one I'm running.

最后,我需要知道如何下载应用程序的 .exe 的较新版本并替换当前的我正在运行一个。

In conclusion I need to know how to download the newer version of .exe of my application and replace the current one I'm running.

推荐答案

实际上,您需要创建一个单独的过程来处理更新步骤。我曾经开发过一种能够从Web服务器接收更新的桌面应用程序,而我是通过创建一个不同的进程来完成此任务的,该进程充当主要应用程序的主要入口点。

Well actually you need to create a separate process to handle the update steps. I have once developed a desktop application with the ability to receive updates form a web server and i did that by creating a different process that roles as the main entry point to the main application.

它在继续运行以检查更新时启动主应用程序进程。然后,如果有可用更新,则将其下载到temp文件夹中,然后在关闭前通知主应用程序,然后提交新更新并再次重新启动主应用程序。

it starts the main application process while it keeps running to check for updates. Then if any updates available it download them to a temp folder after that it notifies the main application before closing it then it commits the new updates and restart the main application again.

但是,如果您要坚持使用一个可执行文件和一个进程。我猜想您无法替换操作系统本身不允许的任何可执行文件。

But if you want to stick with one executable and one process. I guess you can't replace any executable while it is running that's not allowed by the OS itself.

这篇关于更新C#应用程序替换.exe文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆