简体   繁体   English

静默MSI卸载不删除安装文件夹

[英]Silent MSI uninstall dont remove installation folder

I created an empty project, with a visual studio msi installer. 我使用Visual Studio MSI安装程序创建了一个空项目。 On install it just creates the folder and the exe file to the project. 安装时,它仅创建文件夹和exe文件至项目。

But when i am trying to silent uninstall, it remove the installation from program list, but it leaves the folder. 但是,当我尝试静默卸载时,它从程序列表中删除了安装,但是却离开了该文件夹。 I need to remove the folder as well and want to do this without deleting it manually in code. 我还需要删除该文件夹,并且想要执行此操作而无需在代码中手动删除它。

   // This is how to uninstall a basic msi app

        // Create the uninstall process.
        Process proc = new Process();

        // Define the parameters for the process
        proc.StartInfo.FileName = "msiexec.exe";

        // This is the Product Code from your Basic MSI InstallShield Project

        proc.StartInfo.Arguments = "/x" + " " + ProductCode + " " + "/qn";

        // Start the process.
        proc.Start();

        // Wait for the uninstall process to end.
        proc.WaitForInputIdle();
        proc.WaitForExit();

        // Release resources.
        proc.Close();

Instruct the MSI to output a log file using the /L logfile.txt command line option for msiexec . 使用/L logfile.txt命令行选项msiexec指示MSI输出日志文件。 It should tell you why the uninstaller cannot remove the installation file. 它应该告诉您为什么卸载程序无法删除安装文件。 Possible causes include the folder being locked (requiring a reboot to remove) or file permissions on the folder preventing deletion. 可能的原因包括文件夹被锁定(需要重新启动才能删除)或文件夹上的文件权限阻止删除。 See Wix installer could not remove installation folder or Installshield, uninstalling program not removing all folders for more information. 有关更多信息请参阅Wix安装程序无法删除安装文件夹Installshield,卸载程序无法删除所有文件夹

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

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