I've temporarily hardcoded sProductCode to get around the error , but
now get I get a new error when enumerating through the
TableInfoCollection of the session.Database object.

Msg : Exception of type
'Microsoft.Deployment.WindowsInstaller.InstallerException' was thrown. 
ErrorCode : 0 
Data : System.Collections.ListDictionaryInternal 
StackTrace :    at
Microsoft.Deployment.WindowsInstaller.ColumnInfo..ctor(String name,
String columnDefinition)
   at
Microsoft.Deployment.WindowsInstaller.ColumnCollection.GetViewColumns(Vi
ew view)
   at Microsoft.Deployment.WindowsInstaller.TableInfo..ctor(Database db,
String name)
   at
Microsoft.Deployment.WindowsInstaller.TableCollection.<GetEnumerator>d__
0.MoveNext()
   at DKIB_UtilFunctions.CustomActions.DKIB_ExportDataTables(Session
session)

Code snippet :

                     Database MsiDB = session.Database;

                foreach (TableInfo CurTable in MsiDB.Tables)
                {
                    session.Log("Current Table : " + CurTable.Name);

                    if (CurTable.Name.StartsWith("DKIB_"))
                    {
                        session.Log("Starting Export table : " +
CurTable.Name);
                        
                        ExportDKIBTable(MsiDB, CurTable, sProductCode);

                        session.Log("Finished Export table : " +
CurTable.Name);
                    }
                }

ExportDKIBTable method here :

private static void ExportDKIBTable(Database MsiDb, TableInfo CurTable,
string sProductCode)
        {
            using (View vwTable =
MsiDb.OpenView(CurTable.SqlSelectString))
            {
                vwTable.Execute();

                string sFilePath = Path.GetTempPath() + "\\" +
sProductCode;
 
                if(!Directory.Exists(sFilePath))
Directory.CreateDirectory(sFilePath); 

                string sFullFilePath = sFilePath + "\\" + CurTable.Name
+ ".txt";

                if (File.Exists(sFullFilePath))
File.Delete(sFullFilePath);
               
                using (FileStream fs = new FileStream(sFullFilePath,
FileMode.Create, FileAccess.Write))
                {
                    using (StreamWriter sw = new StreamWriter(fs))
                    {
                        foreach (Record CurRec in vwTable)
                        {
                            sw.WriteLine(CurRec.ToString());
                        }
                    }
                }
            }
        }


Is there a particular table in the collection that's causing the error
when trying to read it's name property? 

Should I be using for(int i=0;... Instead?

Is this a know error?

Simon


-----Original Message-----
From: Powell, Simon [mailto:[EMAIL PROTECTED] 
Sent: 11 November 2008 09:56
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Custom Action Error

Hi,
 
I'm getting the following errors in the installation log :
 
MSI (s) (DC:30) [09:49:47:644]: Doing action: DKIB_ExportDataTables
Action ended 09:49:47: InstallValidate. Return value 1.
MSI (s) (DC:30) [09:49:47:644]: Note: 1: 2235 2:  3: ExtendedType 4:
SELECT `Action`,`Type`,`Source`,`Target`, NULL, `ExtendedType` FROM
`CustomAction` WHERE `Action` = 'DKIB_ExportDataTables' 
MSI (s) (DC:FC) [09:49:47:660]: Invoking remote custom action. DLL:
C:\WINDOWS\Installer\MSIF7E.tmp, Entrypoint: DKIB_ExportDataTables
Action start 09:49:47: DKIB_ExportDataTables.
SFXCA: Extracting custom action to temporary directory:
C:\WINDOWS\Installer\MSIF7E.tmp-\
SFXCA: Binding to CLR version v2.0.50727 Calling custom action
DKIB_UtilFunctions!DKIB_UtilFunctions.CustomActions.DKIB_ExportDataTable
s
Begin DKIB_ExportDataTables
Msg : The handle is invalid. 
ErrorCode : 6
Data : System.Collections.ListDictionaryInternal 
StackTrace :    at
Microsoft.Deployment.WindowsInstaller.Session.GetProductProperty(String
property)
   at DKIB_UtilFunctions.CustomActions.DKIB_ExportDataTables(Session
session)
Action ended 09:49:48: DKIB_ExportDataTables. Return value 3.

Below is the customAction code :
 
[CustomAction]
        public static ActionResult DKIB_ExportDataTables(Session
session)
        {
            ActionResult rtnResult = ActionResult.Success;
            session.Log("Begin DKIB_ExportDataTables");
 
            try
            {
                string sProductCode =
session.GetProductProperty("ProductCode");
 
                session.Log("ProductCode = " + sProductCode);
 
                Database MsiDB = session.Database;
 
                foreach (TableInfo CurTable in MsiDB.Tables)
                {
                    if (CurTable.Name.StartsWith("DKIB_"))
                    {
                        session.Log("Exporting table : " +
CurTable.Name);
                        ExportDKIBTable(MsiDB, CurTable, sProductCode);
                    }
                }
            }
            catch (InstallerException InstEx)
            {
                rtnResult = ActionResult.Failure;
                session.Log("Msg : {0} \nErrorCode : {1} \nData : {2}
\nStackTrace : {3}", 
                                                InstEx.Message,
InstEx.ErrorCode, InstEx.Data, InstEx.StackTrace);
            }
 

            return rtnResult;
        }
 
It appears to be failing on the Session.GetProductProperty(String
property) method. Is this a bug? Do you require further information?
 
Thank you
Simon



--
This e-mail is confidential and the information contained in it may be
privileged.  It should not be read, copied or used by anyone other than
the intended recipient.  If you have received it in error, please
contact the sender immediately by telephoning +44 (0)20 7623 8000 or by
return email, and delete the e-mail and do not disclose its contents to
any person.  We believe, but do not warrant, that this e-mail and any
attachments are virus free, but you must take full responsibility for
virus checking.  Please refer to
http://www.dresdnerkleinwort.com/disc/email/ and read our e-mail
disclaimer statement and monitoring policy.

Dresdner Kleinwort is the trading name of the investment banking
division of Dresdner Bank AG, and operates through Dresdner Bank AG,
Dresdner Kleinwort Limited and their affiliated or associated companies.
Dresdner Bank AG is a company incorporated in Germany with limited
liability and registered in England (registered no. FC007638, place of
business 30 Gresham Street, London EC2V 7PG), and is authorised by the
German Federal Financial Supervisory Authority and authorised and
subject to limited regulation by the Financial Services Authority
("FSA"). Details about the extent of our authorisation and regulation by
the FSA are available from us on request.  Dresdner Kleinwort Limited is
a company incorporated in England (registered no. 551334, registered
office 30 Gresham Street, London EC2V 7PG), and is authorised and
regulated by the FSA. 
--

------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge Build the coolest Linux based applications with Moblin SDK &
win great prizes Grand prize is a trip for two to an Open Source event
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


--
This e-mail is confidential and the information contained in it may be 
privileged.  It should not be read, copied or used by anyone other than the 
intended recipient.  If you have received it in error, please contact the 
sender immediately by telephoning +44 (0)20 7623 8000 or by return email, and 
delete the e-mail and do not disclose its contents to any person.  We believe, 
but do not warrant, that this e-mail and any attachments are virus free, but 
you must take full responsibility for virus checking.  Please refer to 
http://www.dresdnerkleinwort.com/disc/email/ and read our e-mail disclaimer 
statement and monitoring policy.

Dresdner Kleinwort is the trading name of the investment banking division of 
Dresdner Bank AG, and operates through Dresdner Bank AG, Dresdner Kleinwort 
Limited and their affiliated or associated companies. Dresdner Bank AG is a 
company incorporated in Germany with limited liability and registered in 
England (registered no. FC007638, place of business 30 Gresham Street, London 
EC2V 7PG), and is authorised by the German Federal Financial Supervisory 
Authority and authorised and subject to limited regulation by the Financial 
Services Authority ("FSA"). Details about the extent of our authorisation and 
regulation by the FSA are available from us on request.  Dresdner Kleinwort 
Limited is a company incorporated in England (registered no. 551334, registered 
office 30 Gresham Street, London EC2V 7PG), and is authorised and regulated by 
the FSA. 
--


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to