简体   繁体   English

使用c#(DTF)中的产品代码在MSI卸载过程中面临的问题

[英]Issue faced during uninstall MSI using its Product Code in c#(DTF)

I am creating a CustomBA which will replace the existing install shield Bootstrapper( I don't really know what it's called). 我正在创建一个CustomBA,它将替换现有的安装屏蔽Bootstrapper(我真的不知道它叫什么)。

We are installing the same number of MSI as the install shield use to do, so no problem in that. 我们要安装的MSI数量与安装防护罩所用的数量相同,因此没有问题。 All the MSI entries in the ARP are removed, as we are making MSI's Visible="no". ARP中的所有MSI条目都将被删除,因为我们将MSI设置为Visible =“ no”。

Only the Custom BA entry is available in the ARP along with the Install shield Bootstrapper entry, both having the same name. ARP中只有“ Custom BA”(自定义BA)条目以及“ Install shield Bootstrapper”(安装盾牌引导程序)条目都可用,两者名称相同。

So after some research I got to know that Windows Installer XML (WiX) ships the Microsoft.Deployment.WindowsInstaller interop library as part of Deployment Tools Foundation (DTF), which can be used to uninstall the MSI. 因此,在进行了一些研究之后,我知道Windows Installer XML(WiX)将Microsoft.Deployment.WindowsInstaller互操作库作为Deployment Tools Foundation(DTF)的一部分提供,可用于卸载MSI。

I am using the below code to uninstall the MSI. 我正在使用以下代码来卸载MSI。

Microsoft.Deployment.WindowsInstaller.Installer.SetInternalUI(InstallUIOptions.Silent);
Microsoft.Deployment.WindowsInstaller.Installer.EnableLog(InstallLogModes.Info, @"C:\Uninstall.log");
Microsoft.Deployment.WindowsInstaller.Installer.ConfigureProduct(productCode, 0, InstallState.Absent, "");

Issue that I am facing are as mentioned below 我面临的问题如下

  1. Firstly I have to run the CustomBA as Administrator to uninstall the existing MSI else it throw as error "Error 1730.You must be an Administrator to remove this application.". 首先,我必须以管理员身份运行CustomBA来卸载现有的MSI,否则它将抛出错误“错误1730。您必须是管理员才能删除此应用程序。”。 Is there a way to run the CustomBA without Administrator and uninstall the MSI. 有没有一种方法可以在没有管理员的情况下运行CustomBA并卸载MSI。

    1. While uninstall( when I run the customBA as admin), the above mentioned code also remove's the chain packages with it, which I don't want it to do. 卸载时(当我以管理员身份运行customBA时),上面提到的代码还删除了带有它的链包,我不希望这样做。

    2. After the uninstallation code has been run it does not remove the MSI entry from the ARP. 运行卸载代码后,它不会从ARP中删除MSI条目。

I've found these links but I don't know if it's relevant: https://stackoverflow.com/questions/17523974/how-to-uninstall-msi-using-its-product-code-in-c-sharp Checking for successful uninstall 我找到了这些链接,但我不知道它们是否相关: https: //stackoverflow.com/questions/17523974/how-to-uninstall-msi-using-its-product-code-in-c-sharp成功卸载

  1. If you need to be admin then you need to be admin. 如果您需要成为管理员,那么您需要成为管理员。 Allowing a limited user to change areas of the system that are restricted would be a security breach. 允许受限用户更改系统的受限区域将违反安全性。

  2. You used the word "chain", so it looks like that InstallShield setup was a multiple-MSI install, perhaps with embedded UI that is suppressed. 您使用了“链”一词,因此看起来InstallShield安装程序是多MSI安装,也许带有隐藏的嵌入式UI。 So it appears that the previous MSIs were installed as single-product view and it looks like they are all uninstalled, also as a single product view - they all uninstall. 因此,以前的MSI似乎是作为单个产品视图安装的,看起来它们都已全部卸载,也看起来像是单个产品视图一样都已卸载。 That was probably the intention in the first place - to make multiple MSIs appear as a single product, all installed and all uninstalled. 首先可能是要这样做-使多个MSI作为一个产品出现,并且全部安装并全部卸载。 Also, if that IS install was a chain of MSIs then surely you are going to replace them all (or upgrade them) anyway, yes? 另外,如果IS安装是一连串的MSI,那么您肯定会全部替换它们(或升级它们),是吗? That's what Burn and BAs will do too. 这就是Burn和BA也会做的。

  3. Which MSI's ARP entry? 哪个MSI的ARP条目? It's not clear from your post which MSI, assuming you may be referring to one of the chained MSIs installed by IS. 从您的帖子中尚不清楚哪个MSI,假设您可能是指IS安装的链式MSI之一。 And are you sure it is an MSI entry that remains? 并且您确定它仍然是MSI条目吗? It might be the chained product's entry that was put there by InstallShield, not an MSI entry. 可能是InstallShield在其中放置的链接产品的条目,而不是MSI条目。 Certainly if your uninstall of the MSI worked its ARP entry would be removed, but may need a refresh to see that it's really gone (but that's a Windows issue). 当然,如果您的MSI卸载工作正常,则它的ARP条目将被删除,但是可能需要刷新才能看到它确实消失了(但这是Windows问题)。 Keep in kind that chained MSI products (and often Burn too) will suppress the individual MSI ARP entries in favor of a single entry that encompasses the multiple MSIs. 保持实心,链接的MSI产品(也经常刻录)会抑制单个MSI ARP条目,而倾向于包含多个MSI的单个条目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM