更新C#应用程序替换.exe文件

编程入门 行业动态 更新时间:2024-10-28 13:28:59
本文介绍了更新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文件

本文发布于:2023-11-02 13:08:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552487.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   文件   exe

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!