当用户升级到新版本时,如何自动关闭旧版本的C#程序?

时间:2021-10-24 06:49:18

Say my users are using version 1.0 of a program, and they decide to upgrade to version 2.0. They may not think to close the old version before they start the installation of the newer version.

假设我的用户正在使用程序的1.0版,他们决定升级到2.0版。他们可能不会想在开始安装新版本之前关闭旧版本。

I use Tarma InstallMate 9 to create installs. How do I automatically close the old version of my .NET program (written in C#) during the upgrade to the latest version?

我使用Tarma InstallMate 9来创建安装。在升级到最新版本的过程中,如何自动关闭旧版本的.NET程序(用C#编写)?

Is this something I would code inside the program, or something I would add to the installer? If the latter, how would I get InstallMate to communicate with the program to allow it to be terminated?

这是我在程序中编写的东西,还是我要添加到安装程序的东西?如果是后者,我如何让InstallMate与程序通信以允许它终止?

What are the best practices in this regard?

这方面的最佳做法是什么?

1 个解决方案

#1


0  

This is a problem specific to the install software you are using, in this case Tarma Installmate 9. Rather than this being a .NET issue you need to find whether or not there are any settings in Tarma Installmate to kill processes.

这是您正在使用的安装软件特有的问题,在这种情况下是Tarma Installmate 9.您需要查找是否在Tarma Installmate中有任何设置来杀死进程。

Since you know the process name I would suggest killing it inside your C# application, but since you presumably have not got the ability to add your own code inside the installer you have no other option.

既然您知道进程名称,我建议您在C#应用程序中将其删除,但由于您可能无法在安装程序中添加自己的代码,因此您没有其他选择。

#1


0  

This is a problem specific to the install software you are using, in this case Tarma Installmate 9. Rather than this being a .NET issue you need to find whether or not there are any settings in Tarma Installmate to kill processes.

这是您正在使用的安装软件特有的问题,在这种情况下是Tarma Installmate 9.您需要查找是否在Tarma Installmate中有任何设置来杀死进程。

Since you know the process name I would suggest killing it inside your C# application, but since you presumably have not got the ability to add your own code inside the installer you have no other option.

既然您知道进程名称,我建议您在C#应用程序中将其删除,但由于您可能无法在安装程序中添加自己的代码,因此您没有其他选择。