http://stackoverflow.com/questions/3560370/custom-action-in-c-sharp-used-via-wix-fails-with-error-1154

Chris has quite a few suggestions on what could cause that error.

-----Original Message-----
From: StevenOgilvie [mailto:sogil...@msn.com] 
Sent: Thursday, October 31, 2013 2:05 PM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Custom action was working now it isn't.... HELP...

A different pair of eyes should help...
I have a custom action that reads the registry and goes through the SQL Server 
Instances to get the last instance name (if there are more than one)... Was 
working like a charm, now for about a week it stopped working and I am getting 
this error:

Action ended 14:57:56: CostFinalize. Return value 1.
MSI (c) (A4:80) [14:57:56:213]: Doing action: CA_GetSQLServerInstanceName 
Action 14:57:56: CA_GetSQLServerInstanceName. CA: Getting SQL Server instance 
name...
Action start 14:57:56: CA_GetSQLServerInstanceName.
MSI (c) (A4:80) [14:57:56:240]: Creating MSIHANDLE (1) of type 790542 for 
thread 7552 MSI (c) (A4:2C) [14:57:56:241]: Invoking remote custom action. DLL:
C:\Users\STEVEN~1.OGI\AppData\Local\Temp\MSIF66D.tmp, Entrypoint:
GetSQLExpressInstanceName
MSI (c) (A4:A4) [14:57:56:242]: Cloaking enabled.
MSI (c) (A4:A4) [14:57:56:242]: Attempting to enable all disabled privileges 
before calling Install on Server MSI (c) (A4:A4) [14:57:56:242]: Connected to 
service for CA interface.
CustomAction CA_GetSQLServerInstanceName returned actual error code 1154 but 
will be translated to success due to continue marking MSI (c) (A4:2C) 
[14:57:56:375]: Closing MSIHANDLE (1) of type 790542 for thread 7552 Action 
ended 14:57:56: CA_GetSQLServerInstanceName. Return value 1.


The custom action is straight forward:
<CustomAction Id="CA_GetSQLServerInstanceName" BinaryKey="BIN_CustomAction"
DllEntry="GetSQLExpressInstanceName" Impersonate="no" Execute="immediate"
Return="ignore" />
    <UI>
      <ProgressText Action="CA_GetSQLServerInstanceName">CA: Getting SQL Server 
instance name...</ProgressText>
    </UI>

<InstallExecuteSequence>
  <Custom Action="CA_GetSQLServerInstanceName" After="InstallInitialize">NOT 
Installed</Custom>

<InstallUISequence>
  <Custom Action="CA_GetSQLServerInstanceName"
Before="MigrateFeatureStates">NOT Installed</Custom>

Using a DTF custom action dll:

/// <summary>
/// Gets the SQL Server Express instance name for the SERVER_NAME /// 
</summary> /// Session session /// <returns>ActionResult Success</returns> 
[CustomAction] public static ActionResult GetSQLExpressInstanceName(Session 
session) {
            try
            {
                if (session == null)
                {
                    throw new ArgumentNullException("session");
                }

                SetSessionProperty(session, "SQLSERVEREXPRESS_INSTANCE", 
string.Empty);

                const string Key = @"SOFTWARE\\Microsoft\\Microsoft SQL 
Server\\Instance Names\\SQL";
                var localMachine = RegistryKey.OpenBaseKey(
                    RegistryHive.LocalMachine,
                    Environment.Is64BitOperatingSystem ?
RegistryView.Registry64 : RegistryView.Registry32);
                var regKey = localMachine.OpenSubKey(Key);
                if (regKey != null)
                {
                    foreach (var valueName in regKey.GetValueNames())
                    {
                        if (!string.Equals(valueName, "MSSQLSERVER"))
                        {
                            var expressKey = @"SOFTWARE\\Microsoft\\Microsoft 
SQL Server\\" + valueName;
                            var expressRegKey = 
localMachine.OpenSubKey(expressKey);
                            if (expressRegKey != null)
                            {
                                SetSessionProperty(session, 
"SQLSERVEREXPRESS_INSTANCE", "\\" + valueName);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteErrorLogInstall(session, "GetSQLExpressInstanceName
failed: ", ex, true);
            }

            return ActionResult.Success; }

Any ideas why this isn't working?

thanks,

Steve



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Custom-action-was-working-now-it-isn-t-HELP-tp7590194.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that 
developers love is also attractive to malware creators. Download this white 
paper to learn more about secure code signing practices that can help keep 
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to