Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
285 views
in Technique[技术] by (71.8m points)

c# - Checking for successful uninstall

I'm trying to automate an install process in which I uninstall a previous version and install a newer version over the top. How should I test (in my bootstrapper, coded in C#) if the uninstall was a success?

This is currently how I'm launching the uninstall.

Process p = Process.Start("msiexec", /*various switches*/);
p.WaitForExit();

I'm also currently tangling with dynamic multiple instances, which really bend my mind, so handling this problem within WiX itself is difficult if not impossible.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As an alternative to handling this in your bootstrapper, and assuming that the installer for the newer version is a Windows Installer package (.msi) under development, you can use Windows Installer functionality to uninstall the older version, where required. When you do that an upgrade can be one of the following:

A major upgrade is basically the removal of the older version and installation of the newer version. WiX allows you to author any of these in a setup project quite easily.

So, your bootstrapper would just need to install the newer version and let Windows Installer do the rest.


BTW—You might want to look at using a WiX Bootstrapper instead of writing your own logic. If you wish, you can write a custom UI in .NET for a WiX Bootstrapper, if that's the reason you're writing your own bootstrapper.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...