Create Folders from text file and place dummy file in them using a CustomAction
Posted
by Birkoff
on Stack Overflow
See other posts from Stack Overflow
or by Birkoff
Published on 2010-05-25T18:00:38Z
Indexed on
2010/05/25
23:11 UTC
Read the original article
Hit count: 364
I want my msi installer to generate a set of folders in a particular location and put a dummy file in each directory.
Currently I have the following CustomActions:
<CustomAction Id="SMC_SetPathToCmd" Property="Cmd" Value="[SystemFolder]cmd.exe"/>
<CustomAction Id="SMC_GenerateMovieFolders" Property="Cmd" ExeCommand="for /f "tokens=* delims= " %a in ([MBSAMPLECOLLECTIONS]movies.txt) do (echo %a)" />
<CustomAction Id="SMC_CopyDummyMedia" Property="Cmd" ExeCommand="for /f "tokens=* delims= " %a in ([MBSAMPLECOLLECTIONS]movies.txt) do (copy [MBSAMPLECOLLECTIONS]dummy.avi "%a"\"%a".avi)" />
These are called in the InstallExecuteSequence:
<Custom Action="SMC_SetPathToCmd" After="InstallFinalize"/>
<Custom Action="SMC_GenerateMovieFolders" After="SMC_SetPathToCmd"/>
<Custom Action="SMC_CopyDummyMedia" After="SMC_GenerateMovieFolders"/>
The custom actions seem to start, but only a blank command prompt window is shown and the directories are not generated.
The files needed for the customaction are copied to the correct directory:
<Directory Id="WIX_DIR_COMMON_VIDEO">
<Directory Id="MBSAMPLECOLLECTIONS" Name="MB Sample Collections" />
</Directory>
<DirectoryRef Id="MBSAMPLECOLLECTIONS">
<Component Id="SampleCollections" Guid="C481566D-4CA8-4b10-B08D-EF29ACDC10B5" DiskId="1">
<File Id="movies.txt" Name="movies.txt" Source="SampleCollections\movies.txt" Checksum="no" />
<File Id="series.txt" Name="series.txt" Source="SampleCollections\series.txt" Checksum="no" />
<File Id="dummy.avi" Name="dummy.avi" Source="SampleCollections\dummy.avi" Checksum="no" />
</Component>
</DirectoryRef>
What's wrong with these Custom Actions or is there a simpler way to do this?
© Stack Overflow or respective owner