Hi, I've wrote a RemoveWholeFolder custom action, to remove all files and sub folders. Here is the code of addthe record to RemoveFile table. private static void AddItemToRemoveFileTable(DirectoryInfo folder, string componentId, Session session, View view) { string fileRecordName = string.Format(CultureInfo.InvariantCulture, "tempRemoveFileRecord_{0}", folderCount); string folderRecordName = string.Format(CultureInfo.InvariantCulture, "tempRemoveFolderRecord_{0}", folderCount); string propertyName = string.Format(CultureInfo.InvariantCulture, "tempRemoveFolderPropertyName_{0}", folderCount); folderCount++;
session[propertyName] = folder.FullName; using (Record record = session.Database.CreateRecord(5)) { record.SetString(1, fileRecordName); record.SetString(2, componentId); // Remove all files under the folder TODO: verify if file without extension could be deleted as well record.SetString(3, "*.*"); record.SetString(4, propertyName); // Install mode: remove on uninstall record.SetInteger(5, 2); view.InsertTemporary(record); } using (Record record = session.Database.CreateRecord(5)) { record.SetString(1, folderRecordName); record.SetString(2, componentId); // remove the folder record.SetString(3, null); record.SetString(4, propertyName); // Install mode: remove on uninstall record.SetInteger(5, 2); view.InsertTemporary(record); } } private static int folderCount = 0; The records are added into the RemoveFile table correctly. However, then the Windows Installer report a fatal error 2727 DEBUG: Error 2727: The directory entry 'tempRemoveFolderPropertyName_0' does not exist in the Directory table MSI (s) (E8:F4) [02:13:39:134]: Product: System Center Atlanta -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2727. The arguments are: tempRemoveFolderPropertyName_0, , There is a property tempRemoveFolderPropertyName_0 but it's not in the Directory table. Property(S): tempRemoveFolderPropertyName_0 = C:\Program Files\Microsoft Atlanta\GatewayData\abc However, according to the document http://msdn.microsoft.com/en-us/library/aa371201(VS.85).aspx , the property is not required to be in Directory table. DirProperty Name of a property whose value is assumed to resolve to the full path to the folder of the file to be removed. The property can be the name of a directory in the Directory table<http://msdn.microsoft.com/en-us/library/aa368295(v=VS.85).aspx>, a property set by the AppSearch table<http://msdn.microsoft.com/en-us/library/aa367579(v=VS.85).aspx>, or any other property that represents a full path. Any idea about why it would fail? P.S. I checked the code in wix-contrib RemoveFolderEx, and find it's doing the same thing as I did. ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users