2012-09-22 108 views
1

我创建了一个空的项目,与Visual Studio MSI安装程序。在安装时,它只是创建文件夹和exe文件到项目中。无声MSI卸载不删除安装文件夹

但是,当我试图无声卸载时,它从程序列表中删除安装,但它会离开文件夹。我需要删除该文件夹,并且希望在不以代码手动删除的情况下执行此操作。

// 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(); 

回答