0
votes

I have following Wix File that is supposed to install the contents in C:\SampleProgram . The generated msi is supposed to be installed as msiexec /i installer.msi IPADDRESS="1.1.1.1". The parameter IPADDRESS is fetched by Custom Action that will make a config file as below in the folder where program installs itself.

{
  "ip" : "1.1.1.1" 
}

The problem is that the generated Installation File works fine in one of my machine but it only creates a config file in other machine. The folder where the MSI installed successfully will have all the Component Files defined under ComponentGroup of my wix File. If Installed successfully, the Installer will copy all those components in Installed Folder. Even though It didn't install the files, but it ran the Custom Action.

The verbose log is given here.

If one searches Component: BoostThreadLibrary , I get Installed: Absent, which as given here says that Component or feature is not currently installed..

Is the error related to my machine or this code.

I have attached wix file below:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="SampleProgram" Language="1033" Version="3.0.0" Manufacturer="Learning" UpgradeCode="a0265d05-8e65-4af2-98e1-a675b728dd2d">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate EmbedCab="yes" />

        <Feature Id="ProductFeature" Title="SampleProgram" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="WindowsVolume">
        <Directory Id="INSTALLFOLDER" Name="SampleProgram" />
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="ProductComponent">
        <File
          Id="LPAEXE"
          Name="lpa.exe"
          DiskId="1"
          Source="$(var.lpa.TargetPath)"
          Vital="yes"
          KeyPath="yes" />

        <?if $(var.Configuration) = "Release"?>
          <ServiceInstall Id="ServiceInstaller" Type="ownProcess" Vital="yes"
                          Name="LearningService" DisplayName="LearningService"
                          Description="How to make a Service" Start="auto"
                          Account="LocalSystem" ErrorControl="normal" Interactive="no" />

          <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall"
                          Name="LearningService" Wait="yes" />
        <?endif?>
      </Component>
      <Component Id="BoostThreadLibrary">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_thread-vc100-mt-gd-1_55.dll" />
        <?else?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_thread-vc100-mt-1_55.dll" />
        <?endif?>
      </Component>
      <Component Id="BoostSystemLibrary">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_system-vc100-mt-gd-1_55.dll" />
        <?else?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_system-vc100-mt-1_55.dll" />
        <?endif?>
      </Component>
      <Component Id="BoostChronoLibrary">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_chrono-vc100-mt-gd-1_55.dll" />
        <?else?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_chrono-vc100-mt-1_55.dll" />
        <?endif?>
      </Component>
      <Component Id="BoostFileSystemLibrary">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_filesystem-vc100-mt-gd-1_55.dll" />
        <?else?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_filesystem-vc100-mt-1_55.dll" />
        <?endif?>
      </Component>
      <Component Id="BoostDateTimeLibrary">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_date_time-vc100-mt-gd-1_55.dll" />
        <?else?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_date_time-vc100-mt-1_55.dll" />
        <?endif?>
      </Component>

      <Component Id="BoostZlibLibrary">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_zlib-vc100-mt-gd-1_55.dll" />
        <?else?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_zlib-vc100-mt-1_55.dll" />
        <?endif?>
      </Component>
      <Component Id="BoostIOStreamLibrary">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_iostreams-vc100-mt-gd-1_55.dll" />
        <?else?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_iostreams-vc100-mt-1_55.dll" />
        <?endif?>
      </Component>
      <Component Id="BoostRegexLibrary">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_regex-vc100-mt-gd-1_55.dll" />
        <?else?>
        <File Source ="C:\boost_1_55_0_dyn\stage\lib\boost_regex-vc100-mt-1_55.dll" />
        <?endif?>
      </Component>
      <Component Id="libeay32">
        <File Source ="C:\OpenSSL-Win32\libeay32.dll" />
      </Component>
      <Component Id="ssleay32">
        <File Source ="C:\OpenSSL-Win32\ssleay32.dll" />
      </Component>
      <Component Id="czmq">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="..\..\ext_library\zmq\czmq\czmq-2.1.0\lib\Win32\DebugDLL\czmq.dll" />
        <?else?>
        <File Source ="..\..\ext_library\zmq\czmq\czmq-2.1.0\lib\Win32\ReleaseDLL\czmq.dll" />
        <?endif?>
      </Component>

      <Component Id="log4cplus">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="..\..\ext_library\log4cplus\bin\Debug\log4cplusD.dll" />
        <?else?>
        <File Source ="..\..\ext_library\log4cplus\bin\Release\log4cplus.dll" />
        <?endif?>
      </Component>
      <Component Id="libzmq">
        <?if $(var.Configuration) = "Debug"?>
        <File Source ="..\..\ext_library\zmq\zeromq-4.0.3\lib\Win32\Debug\libzmq.dll" />
        <?else?>
        <File Source ="..\..\ext_library\zmq\zeromq-4.0.3\lib\Win32\Release\libzmq.dll" />
        <?endif?>
      </Component>
      <Component Id="SSL_Crt_File">
        <File Source ="..\..\src\keys\ca.crt" />
      </Component>

    </ComponentGroup>    
    <Binary Id="SetupCA"  SourceFile="..\..\ext_library\SetupCA\SetupCA\bin\Release\SetupCA.CA.dll"/>
    <CustomAction Id="WRITEFILETODISK" Execute="immediate" BinaryKey="SetupCA" DllEntry="WriteFileToDisk" />
    <InstallExecuteSequence>
      <Custom Action="WRITEFILETODISK" Sequence="2"></Custom>
    </InstallExecuteSequence>
  </Fragment>
</Wix>
2

2 Answers

0
votes

The core of your problem is the scheduling of your custom action:

<CustomAction Id="WRITEFILETODISK" Execute="immediate" BinaryKey="SetupCA" DllEntry="WriteFileToDisk" />
<InstallExecuteSequence>
  <Custom Action="WRITEFILETODISK" Sequence="2"></Custom>
</InstallExecuteSequence>

As an immediate action scheduled before InstallFinalize, any changes to files will not have occurred by the time this custom action is run. While that can be important for, say, an uninstallation, this is probably the opposite of what you want for an installation.

To read files that are installed by your installation, you should schedule your action Execute="deferred", and sometime after InstallFiles. If you are modifying items in a system location, it should also be Impersonate="No", which only works in the deferred execution context.

Note that once your action is deferred, you will have to access properties through CustomActionData.

0
votes

I don't know why but changing the upgrade code to other GUID did solved the issue.