0

I am trying to run an executable VBscript (.EXE) after all the files are placed on the target machine. the installer that is being used is made in Visual Studio 2013 with the WIX toolset. I tried a couple of examples from different sources like technet and this website. However none could help me since a lot of those articles/post are from around 2008 and don't seem to apply anymore.

currently I am using this piece of code to try to archieve my goal:

     <Fragment>
    <CustomAction
      Id="RunInstallScript"
      Directory="INSTALLFOLDER"
      ExeCommand="[INSTALLFOLDER]Installation script.exe"
      Execute="commit"
      Return="ignore"
    />
    <InstallExecuteSequence>
    <Custom Action="RunInstallScript" Before="InstallFinalize" />
  </InstallExecuteSequence>
  </Fragment>

Even though the compiler doesn't see any errors and compiles just fine the code isn't working. The file that needs to be executed is placed in the installation folder, so the file is present. The only thing left is to execute it once during installation and/or De-installation.

I have searched for information for a long time in order to figure it out, bud i just can't get it working the way I would like it. if this problem is solved I will finaly have a fully functioning installer that I can deploy to streamline the setup of control panels.

all help and suggestions are welcome.

thanks in advance,

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
F.J
  • 35
  • 10
  • How did you make your "executable VBScript"? – Bond Jul 08 '15 at 12:59
  • instead of running your own script, can you run somethings else? just for test purpose. let's say, can you run CALC.EXE? – Zam Jul 08 '15 at 15:23
  • @Bond take a look at answers on http://stackoverflow.com/questions/4425681/how-can-i-convert-a-vbscript-to-an-executable-exe-file – Zam Jul 08 '15 at 15:25
  • @Zam I know there are ways to do it. But I want to know how _he_ did it. :) – Bond Jul 08 '15 at 15:31
  • I created an Visual Basic console application and when build it delivers beside an .VB file also an .EXE file. that is the file i added to the WIX installer and want to execute once during installation. when i execute it by hand it does work. also I did test it with another installer builder called Advanced Installer and that did work just fine when added as an custom action. bud as we all know WIX works a little differend :) – F.J Jul 09 '15 at 05:41
  • anyone an idea how I can get this executable to run before the installation finishes? – F.J Jul 14 '15 at 05:57
  • Have you looked into the MSI log? – Edgar Jul 16 '15 at 05:56
  • I enabled the windows installer logging in Windows 7 and it says that the installation is succesfull. It doesn't show any errors at all. so no indication there for why it doesn't execute the file. – F.J Aug 03 '15 at 07:10

1 Answers1

0

I figured out what the problem was. it seems that the declaration and calling of the custom action need to be in the same fragment as the add file function. so it will look something like this:

    <Fragment>

    <ComponentGroup Id="script" Directory="INSTALLFOLDER">
      <Component Id="InstallationScript" Guid="{AFA49EED-4F2C-42B4-B7EC-D3B7896C970C}">
        <File Id="InstallationScript" KeyPath="yes" Source="C:\Users\fjansen\Documents\Visual Studio 2013\Projects\Wix test\Installation script\bin\Debug\InstallationScript.exe" />
      </Component>
    </ComponentGroup>

    <CustomAction
      Id="InstallScript"
      Directory="INSTALLFOLDER"
      ExeCommand="[INSTALLFOLDER]InstallationScript.exe"
      Execute="commit"
      Return="check">
    </CustomAction>
    <InstallExecuteSequence>
      <Custom Action="InstallScript" Before="InstallFinalize" />
    </InstallExecuteSequence>

  </Fragment>

it was just a small error in the end bud it was not easy to find what the problem was. i hope this example will help people solve this same problem and save them a lot of time figuring out what the problem is.

F.J
  • 35
  • 10