I have the following target in a project

  <target name="extract-msi" depends="init" if="target.os.windows" >
    <mkdir dir="${build.dir}/extract/msi" />
    <apply executable="msiexec" failonerror="true" >
      <arg value="/a" /> <!-- administrative install -->
      <srcfile/>
      <arg value='TARGETDIR="${build.dir}\extract\msi"' />
      <fileset dir="${src.dir}" >
        <include name="**/*.msi" />
      </fileset>
    </apply>
  </target>

Basically the problem appears to be with the TARGETDIR line. If I remove that 
line, then the msiexec command will run just fine, but will extract the msi 
contents to the wrong location (C:\). It seems that despite the claims in the 
console:
The ' characters around the executable and arguments are
not part of the command.

It seems that the command is in fact executed with them wrapped around it, 
since running the following at the command prompt will fail (subsituted in some 
values):
msiexec '/a' 'C:\Documents and Settings\<filename>.msi' 
'TARGETDIR="C:\Documents and Settings\<basedir>\build\extract\msi"'

While this works:
msiexec '/a' 'C:\Documents and Settings\<filename>.msi' TARGETDIR="C:\Documents 
and Settings\<basedir>\build\extract\msi"


I've got the following to work, but it's only useful as long as there is only 1 
msi to be processed.
  <target name="extract-msi" depends="init" if="target.os.windows" >
    <mkdir dir="${build.dir}/extract/msi" />
    <fileset dir="${src.dir}" id="files.msi" >
      <include name="**/*.msi" />
    </fileset>
    <exec executable="cmd" failonerror="true" >
      <arg value="/c" />
      <arg value='msiexec /a "${src.dir}\${toString:files.msi}" /qn 
TARGETDIR="${build.dir}\extract\msi" /l*v "${build.dir}\msi.log"' />
    </exec>
  </target>


Any suggestions on how to utilise the apply task to have this work for when 
dealing with multiple msi's as opposed to only being able to handle one?

I've tried experimenting with the line, file, value versions of the arg 
element, all produce the same result.

--
Regards,
Darragh Bailey

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to