2012-09-22 147 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(); 

回答