0
votes

I have created a wix installer for my desktop application.I have added some custom actions to it.The installer works fine on my development machine but the custom actions are not getting called on client machine.So, should I install wix framework on the client machine for the custom actions to work?Or do I have to install windows installer on the machine? Please, note that after installation on client machine, application does shows up in the Add or remove programs.Just the custom actions are not getting called.I am using wix 3.10.3.3007 . The custom actions project is based on .net framework 4.5.The contents of its config file are as follows:

<?xml version="1.0" encoding="utf-8" ?> <configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">

        <!--
          Use supportedRuntime tags to explicitly specify the version(s) of the .NET Framework runtime that
          the custom action should run on. If no versions are specified, the chosen version of the runtime
          will be the "best" match to what Microsoft.Deployment.WindowsInstaller.dll was built against.

          WARNING: leaving the version unspecified is dangerous as it introduces a risk of compatibility
          problems with future versions of the .NET Framework runtime. It is highly recommended that you specify
          only the version(s) of the .NET Framework runtime that you have tested against.

          Note for .NET Framework v3.0 and v3.5, the runtime version is still v2.0.

          In order to enable .NET Framework version 2.0 runtime activation policy, which is to load all assemblies 
          by using the latest supported runtime, @useLegacyV2RuntimeActivationPolicy="true".

          For more information, see http://msdn.microsoft.com/en-us/library/bbx34a2h.aspx
        -->

        <supportedRuntime version="v4.0" />
        <supportedRuntime version="v2.0.50727"/>

    </startup>

    <!--
      Add additional configuration settings here. For more information on application config files,
      see http://msdn.microsoft.com/en-us/library/kza1yk3a.aspx
    -->

</configuration>

Also, the here is the code to call custom actions in the Product.wxs file:

  <CustomAction Id="UninstallSetPro"   Execute="immediate" Property="SectionName"  Value="Uninstall" />
    <CustomAction Id="InstallSetPro" Execute="immediate" Property="SectionName" Value="Install" />
    <CustomAction Id="Install" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="RegistryInstall"   />
    <CustomAction Id="Uninstall" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="RegistryInstall"   />
    <CustomAction Id="CopyOrderingFile" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="CopyOrderingFile"  />
    <CustomAction Id="ModifyConfigFile" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="modifyConfigFile"  />
    <CustomAction Id="AddInstallationParamToConfigFile" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="AddInstallationParametersToConfigFile"  />
    <InstallExecuteSequence>
      <Custom Action="InstallSetPro" After="WriteRegistryValues" >$ProductFiles&gt;2</Custom>
      <Custom Action="Install" After="InstallSetPro">$ProductFiles&gt;2</Custom>
      <Custom Action="CopyOrderingFile"  After="InstallFinalize">NOT Installed</Custom>
      <Custom Action="ModifyConfigFile"  After="InstallFinalize">NOT Installed</Custom>
      <Custom Action="AddInstallationParamToConfigFile"  After="ModifyConfigFile">NOT Installed</Custom>
      <Custom Action="UninstallSetPro" After="MsiUnpublishAssemblies" > $ProductFiles=2</Custom>
      <Custom Action="Uninstall" After="UninstallSetPro">$ProductFiles=2</Custom>
    </InstallExecuteSequence>

EDIT-Also, another thing I noticed is that when I run

Setup.exe -l LogFile.txt

command for logs on my machine, I am able to see the installer UI, but on client machine the installer UI is not shown.It installs it silently.


Edit 2 - I have seen the log files and they show that custom actions were called and they returned 1.But the code in the custom action didn't execute as I had added code there to write to a log file when the control reaches the first line of custom action function.Here is the extract from installer log where it shows that the custom action was called:

Action ended 10:27:49: WriteRegistryValues. Return value 1. MSI (s) (8C:2C) [10:27:49:161]: Doing action: InstallSetPro MSI (s) (8C:2C) [10:27:49:161]: Note: 1: 2205 2: 3: ActionText Action 10:27:49: InstallSetPro. Action start 10:27:49: InstallSetPro. MSI (s) (8C:2C) [10:27:49:161]: PROPERTY CHANGE: Adding SectionName property. Its value is 'Install'. Action ended 10:27:49: InstallSetPro. Return value 1. MSI (s) (8C:2C) [10:27:49:161]: Doing action: Install MSI (s) (8C:2C) [10:27:49:161]: Note: 1: 2205 2: 3: ActionText Action 10:27:49: Install. Action start 10:27:49: Install. MSI (s) (8C:C4) [10:27:49:208]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI77C0.tmp, Entrypoint: RegistryInstall MSI (s) (8C:C0) [10:27:49:317]: Generating random cookie. MSI (s) (8C:C0) [10:27:49:348]: Created Custom Action Server with PID 5356 (0x14EC). MSI (s) (8C:34) [10:27:49:458]: Running as a service. MSI (s) (8C:34) [10:27:49:458]: Hello, I'm your 32bit Impersonated custom action server. SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSI77C0.tmp-\ SFXCA: Binding to CLR version v4.0.30319 Calling custom action Installer_CustomActions!Installer_CustomActions.CustomActions.RegistryInstall Action ended 10:27:50: Install. Return value 1.

Could it be that the dll that I am referencing in custom action project to write my logs is causing the problem?

2

2 Answers

0
votes

No, you don't need WiX installed to run a CA.

I assume your setup.exe is a burn bootstrapper and that it's doing the UI and telling your primary MSI to run silently.

I also notice that those custom actions are all set to run in immeadiate execution context. That is probably an incorrect design. I would read:

http://www.installsite.org/pages/en/isnews/200108/

Custom Action in C# used via WiX fails with error 1154

My guess is your conditions aren't evaluating the way you think and the custom actions aren't running. Either that or they are failing and swallowing the error. You need to read your log files to learn more.

0
votes

The problem was with a registry entry.The custom action wasn't able to read a registry , hence the it was not installing properly.