I have just started using the Deployment Tools Foundation libraries in
Wix 3.0. However I have come across a problem when trying to delete a
property from an existing msi. The code I am using is as follows:
// open the database
Database database = new
Microsoft.Deployment.WindowsInstaller.Database(@"C:\Dev\Temp\IES.msi",
DatabaseOpenMode.Direct);
// open view
Microsoft.Deployment.WindowsInstaller.View v = database.OpenView("SELECT
* FROM `Property` WHERE `Property`='Test'");
// execute view
v.Execute();
// fetch and delete record
Record record = v.Fetch;
v.Modify(ViewModifyMode.Delete, record);
If have excluded closing the view, database, and checking the outcome of
fetch purely for brevity, but when I perform the call to v.Modify I get
an InstallerException with the message "Function failed during
execution, Database: C:\Dev\Temp\IES.msi. Cursor in invalid state." The
record is definitely returned from Fetch and in addition to this updates
work fine.
To prove there was nothing funny with the msi I did the same directly
against the API and it works fine, the code is as follows:
// open the database
result = SafeNativeMethods.MsiOpenDatabase(@"C:\Dev\Temp\IES.msi",
MsiDbPersistMode.Direct, out databaseHandle);
// open view
result = SafeNativeMethods.MsiDatabaseOpenView(databaseHandle, "SELECT *
FROM `Property` WHERE `Property`='Test'", out viewHandle);
// execute view
result = SafeNativeMethods.MsiViewExecute(viewHandle, recordHandle);
// fetch and delete record
result = SafeNativeMethods.MsiViewFetch(viewHandle, ref recordHandle);
result = SafeNativeMethods.MsiViewModify(viewHandle, 6, recordHandle);
Therefore the above two code samples are functionally equivalent but the
one using the DTF classes does not work. Does anybody know if I am
missing something obvious here? I have not looked too closely at the DTF
sources yet as I wanted to rule out user error first.
Any advise would be most appreciated.
-----------------------------------------------------------------------------------------------------
HBOS plc, Registered in Scotland No. SC218813. Registered Office: The Mound,
Edinburgh EH1 1YZ. HBOS plc is a holding company, subsidiaries of which are
authorised and regulated by the Financial Services Authority.
==============================================================================
------------------------------------------------------------------------------
_______________________________________________
WiX-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-devs