Hi folks,

I have spent WAY TOO much time on this...

I get an error 1154 (please don't tell me to refer to blah blah) I have 2
custom actions...

1 works, the other doesn't

The custom action CA_UPGRADE_GET_WEBPORTNUM works, the
CA_UPGRADE_GET_CONNECTSTR doesn't...

scenario:
When we run an upgrade I need to get info from previous install and store
them into MSI Properties so that after the upgrade uninstalls the previous
version then installs the new version we just populate some info from the
previous install to the new install instead of running code to create the
info...

As you see I have created a SIMPLE custom action that just pops up a message
box then returns actionresult.success....


PRODUCT.WXS:

include file:
<?define TitusInstallerCA =
"$(var.scSourcePath)\Main\Resources\TitusInstaller.CA.dll"?>

<Binary Id="BIN_CustomAction" SourceFile="$(var.TitusInstallerCA)"/>

<CustomAction Id="CA_UPGRADE_GET_WEBPORTNUM" BinaryKey="BIN_CustomAction"
DllEntry="GetWebSitePortNumber" Impersonate="yes" Execute="immediate"
Return="ignore"/>
    <UI>
      <ProgressText Action="CA_UPGRADE_GET_WEBPORTNUM">CA: Getting TITUS web
site port number...</ProgressText>
    </UI>

<CustomAction Id="CA_UPGRADE_GET_CONNECTSTR" BinaryKey="BIN_CustomAction"
DllEntry="GetServicesConnectString" Impersonate="yes" Execute="immediate"
Return="ignore"/>

<InstallExecuteSequence>
      <Custom Action="CA_UPGRADE_GET_WEBPORTNUM"
Before="RemoveExistingProducts">WIX_UPGRADE_DETECTED</Custom>
      <Custom Action="CA_UPGRADE_GET_CONNECTSTR"
After="CA_UPGRADE_GET_WEBPORTNUM">WIX_UPGRADE_DETECTED</Custom>

<InstallUISequence>
      <Custom Action="CA_UPGRADE_GET_WEBPORTNUM"
After="MigrateFeatureStates">WIX_UPGRADE_DETECTED</Custom>
      <Custom Action="CA_UPGRADE_GET_CONNECTSTR"
After="CA_UPGRADE_GET_WEBPORTNUM">WIX_UPGRADE_DETECTED</Custom>
    </InstallUISequence>

CUSTOM ACTION CODE:

[CustomAction]
        public static ActionResult GetServicesConnectString(Session session)
        {
            MessageBox.Show("GetServicesConnectionSTring", "get services
connect string", MessageBoxButtons.OK);
            return ActionResult.Success;
        }

[CustomAction]
        public static ActionResult GetWebSitePortNumber(Session session)
        {
            try
            {
                if (session == null)
                {
                    throw new ArgumentNullException("session");
                }

                const string FireWallName = "TITUS Web Administration Port";

                var firewallPolicy =
(INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));

                var rule = firewallPolicy.Rules.Item(FireWallName);
                var fireWallPortNumber = rule.LocalPorts;

                SetSessionProperty(session, "ALLOW_REMOTE_ACCESS",
rule.Enabled ? "1" : "0");
                SetSessionProperty(session, "REMOTEACCESS_VALUE",
rule.Enabled ? "True" : "False");

                MessageBox.Show(fireWallPortNumber, "Fire wall port number",
MessageBoxButtons.OK);

                SetSessionProperty(session, "WEB_SITE_PORT",
fireWallPortNumber);
            }
            catch (Exception ex)
            {
                WriteErrorLogInstall(session, "GetWebSitePortNumber failed:
", ex, true);
                return ActionResult.Failure;
            }

            WriteSuccessLogInstall(session, "GetWebSitePortNumber
succeeded...", true);
            return ActionResult.Success;
        }


LOG FILE:

Action ended 13:37:38: MigrateFeatureStates. Return value 1.
MSI (c) (38:00) [13:37:38:336]: Doing action: CA_UPGRADE_GET_WEBPORTNUM
Action 13:37:38: CA_UPGRADE_GET_WEBPORTNUM. CA: Getting TITUS web site port
number...
Action start 13:37:38: CA_UPGRADE_GET_WEBPORTNUM.
MSI (c) (38:00) [13:37:38:336]: Creating MSIHANDLE (8) of type 790542 for
thread 4608
MSI (c) (38:28) [13:37:38:336]: Invoking remote custom action. DLL:
C:\Users\ADMINI~1.DEV\AppData\Local\Temp\1\MSID745.tmp, Entrypoint:
GetWebSitePortNumber
MSI (c) (38!E4) [13:37:38:430]: Creating MSIHANDLE (9) of type 790531 for
thread 4836
SFXCA: Extracting custom action to temporary directory:
C:\Users\ADMINI~1.DEV\AppData\Local\Temp\1\MSID745.tmp-\
MSI (c) (38!E4) [13:37:38:430]: Closing MSIHANDLE (9) of type 790531 for
thread 4836
MSI (c) (38!E4) [13:37:38:679]: Creating MSIHANDLE (10) of type 790531 for
thread 4836
SFXCA: Binding to CLR version v4.0.30319
MSI (c) (38!E4) [13:37:38:679]: Closing MSIHANDLE (10) of type 790531 for
thread 4836
MSI (c) (38!E4) [13:37:38:742]: Creating MSIHANDLE (11) of type 790531 for
thread 4836
Calling custom action
TitusInstaller!Titus.Installer.CustomActions.CustomAction.GetWebSitePortNumber
MSI (c) (38!E4) [13:37:38:742]: Closing MSIHANDLE (11) of type 790531 for
thread 4836
MSI (c) (38!E4) [13:37:38:774]: PROPERTY CHANGE: Adding ALLOW_REMOTE_ACCESS
property. Its value is '1'.
MSI (c) (38!E4) [13:37:38:774]: PROPERTY CHANGE: Adding REMOTEACCESS_VALUE
property. Its value is 'True'.
MSI (c) (38!E4) [13:37:40:413]: PROPERTY CHANGE: Adding WEB_SITE_PORT
property. Its value is '34350'.
MSI (c) (38!E4) [13:37:40:413]: Creating MSIHANDLE (12) of type 790531 for
thread 4836
2014-03-04 13:37:40: SUCCESS: 
-----------------------------------------------
MSI (c) (38!E4) [13:37:40:430]: Closing MSIHANDLE (12) of type 790531 for
thread 4836
MSI (c) (38!E4) [13:37:40:430]: Creating MSIHANDLE (13) of type 790531 for
thread 4836
GetWebSitePortNumber succeeded...
MSI (c) (38!E4) [13:37:40:430]: Closing MSIHANDLE (13) of type 790531 for
thread 4836
MSI (c) (38:28) [13:37:40:491]: Closing MSIHANDLE (8) of type 790542 for
thread 4608
Action ended 13:37:40: CA_UPGRADE_GET_WEBPORTNUM. Return value 1.
MSI (c) (38:00) [13:37:40:491]: Doing action: CA_UPGRADE_GET_CONNECTSTR
Action 13:37:40: CA_UPGRADE_GET_CONNECTSTR. 
Action start 13:37:40: CA_UPGRADE_GET_CONNECTSTR.
MSI (c) (38:00) [13:37:40:491]: Creating MSIHANDLE (14) of type 790542 for
thread 4608
MSI (c) (38:40) [13:37:40:491]: Invoking remote custom action. DLL:
C:\Users\ADMINI~1.DEV\AppData\Local\Temp\1\MSIDFB3.tmp, Entrypoint:
GetServicesConnectString
CustomAction CA_UPGRADE_GET_CONNECTSTR returned actual error code 1154 but
will be translated to success due to continue marking
MSI (c) (38:40) [13:37:40:555]: Closing MSIHANDLE (14) of type 790542 for
thread 4608
Action ended 13:37:40: CA_UPGRADE_GET_CONNECTSTR. Return value 1.




--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/DTF-custom-action-not-working-but-an-almost-identical-is-tp7593106.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&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