0
votes

I have a little problem with executing a VBscript from my .MSI package I made in WIX. when trying to build the projects it throws 2 errors:

The CustomAction element's DllEntry, Error, ExeCommand, JScriptCall, Script, Value, or VBScriptCall attribute was not found; one of these is required.

and

The CustomAction element contains illegal inner text: 'Directory="INSTALLFOLDER"

I don't fully understand why it throws these errors.

I did give it the INSTALLFOLDER as directory since that is where the VBscript is located and the second error is unknown to me since I don't fully understand how to format ExeCommand.

This is the code I used:

<Feature Id="ProductFeature" Title="wix_script_execution" Level="1">
          <ComponentGroupRef Id="script"/>
            </Feature>
        </Product>

        <Fragment>
            <Directory Id="TARGETDIR" Name="SourceDir">
                <Directory Id="ProgramFilesFolder">
                    <Directory Id="INSTALLFOLDER" Name="wix_script_execution" />
                </Directory>
            </Directory>
        </Fragment>

      <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\obj\Debug\Installation script.exe" />
          </Component>
        </ComponentGroup>
      </Fragment>

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

The fragment with the custom action in it was copied from the internet and modified by me, but apparently not in the right way.

The end goal is that this VBscript runs automatically after all the files are copied to their destination.

The VBscript only needs to execute once and doesn't need to be installed.

ADDED 7-7-2015:

I was finaly able to test the proposed information. however it is still not executing the file,I dont get any errors when compiling the project and because of that it is not clear to me what the cause is.

this is the code I used with the suggestions incorperated in it:

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

I think the problem has something to do with ExeCommand since it just doesn't execute the script. bud I just can't get it to work, what am I missing?

thanks in advance.

1

1 Answers

0
votes
<CustomAction Id="RunInstallScript">
    Directory="INSTALLFOLDER"
    ExeCommand="[INSTALLFOLDER]Installation script.exe"
    Execute="commit"
    Return="ignore"/>
  </CustomAction>

There's an extra > after Id="RunInstallScript", so your attributes (e.g. Directory=) became inner text. If you remove that character, those errors will go away. There's also an extra closing tag -- it should either be /> or ></CustomAction>. In the end, that custom action should look something like:

<CustomAction Id="RunInstallScript"
  Directory="INSTALLFOLDER"
  ExeCommand="[INSTALLFOLDER]Installation script.exe"
  Execute="commit"
  Return="ignore"/>