简体   繁体   English

MSI(从WIX创建)-卸载应用程序未删除根安装文件夹

[英]MSI (created from WIX)- Uninstall application is not removing the root installation folder

MSI (created from WIX)- Uninstall application is not removing the root installation folder. MSI(从WIX创建)-卸载应用程序未删除根安装文件夹。

1) I have installed the MSI (example: selected installation root location: C:/MSI_test/ and installed with AppName. And final location is C:/MSI_test/AppName/ ) and part of the installation copied MSI into my installation location (for repair purpose from uninstall shortcut Key. When I click the uninstall shortcut it points to the MSI in my installed directory and opens a dialog with Repair or Remove option) 1)我已经安装了MSI(例如:选择的安装根目录: C:/ MSI_test /并使用AppName进行安装。最终位置是C:/ MSI_test / AppName / ),并且安装的一部分将MSI复制到了我的安装位置(对于通过卸载快捷方式密钥进行修复的目的。当我单击卸载快捷方式时,它指向我已安装目录中的MSI,并打开一个带有“修复”或“删除”选项的对话框)

2) If the user tries to uninstall this application from the uninstall shortcut, it removes all the installed files and folders but not removing the root installation location (ie C:/MSI_test/AppName/ ). 2)如果用户尝试从卸载快捷方式中卸载此应用程序,它将删除所有已安装的文件和文件夹,但不删除根安装位置(即C:/ MSI_test / AppName / )。

Below is the code having in my uninstall.bat file (which is called during uninstall shortcut) 下面是我的uninstall.bat文件中包含的代码(在卸载快捷方式中称为)

cmd.exe /c start "" "C:\MSI_test\AppName\Config\App.msi"
exit;

3) If I have MSI in different location (ie in C:/testing) and trying to uninstall the application, it removes everything (ie installed files and folders including root installation location) 3)如果我在不同的位置(例如,在C:/ testing中)有MSI,并尝试卸载该应用程序,它将删除所有内容(即,已安装的文件和文件夹,包括根安装位置)

4) Is this a problem to delete the root folder if we are trying to uninstall from the above step-2 to delete the root installation folder? 4)如果我们尝试从上述步骤2中卸载以删除根安装文件夹,则删除根文件夹是否存在问题?

The problem you're having is likely to be that your uninstall is holding the folder open. 您遇到的问题很可能是您的卸载使文件夹保持打开状态。 I've solved this problem previously by creating an exe that does the uninstall and copying it to the Temp folder andf running the uninstall program from there, and people generally clean up the temp folder anyway. 以前,我已经通过创建一个执行卸载并将其复制到Temp文件夹并从那里运行卸载程序的f来解决了此问题,通常人们还是会清理temp文件夹。

This might be a better way of doing it too: 这也可能是更好的方法:

http://robmensching.com/blog/posts/2007/4/27/how-to-create-an-uninstall-shortcut-and-pass-all-the/ http://robmensching.com/blog/posts/2007/4/27/how-to-create-an-uninstall-shortcut-and-pass-all-the/

What you're seeing is the result of a lock being placed on that folder or its contents, likely as a result of the batch file itself executing (which sets the working directory of the command interpreter running it to the folder it is in, and places a read lock on the folder). 您所看到的是在该文件夹或其内容上放置了锁定的结果,很可能是由于批处理文件本身执行了(将运行它的命令解释器的工作目录设置为它所在的文件夹,并且将读取锁放在文件夹上)。

That said, I'm unsure why you're making a copy of the MSI in the application folder anyway, as the Windows Installer will make a copy itself and place it in %windir%\\Installer. 就是说,我不确定为什么仍要在应用程序文件夹中制作MSI的副本,因为Windows Installer会自己制作一个副本并将其放置在%windir%\\ Installer中。 When you kick off your uninstall from the shortcut, the installer reads the product code from the MSI you provided it and then goes back to the cached copy anyway. 当您从快捷方式启动卸载时,安装程​​序将从提供的MSI中读取产品代码,然后无论如何都返回到缓存的副本。

Ideally, you should do away with the batch file and place a direct shortcut to msiexec.exe /i {product-code} - this will kick off the installation/maintenance UI for your product if it is installed. 理想情况下,您应该删除该批处理文件,并直接指向msiexec.exe / i {product-code}的快捷方式-如果已安装产品,它将启动产品的安装/维护UI。 If you must have a batch file, you will need to place it outside your application's installation root. 如果必须具有批处理文件,则需要将其放置在应用程序的安装根目录之外。

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

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