开发者

Create Folders from text file and place dummy file in them using a CustomAction

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_GenerateMovieFol开发者_如何学JAVAders" Property="Cmd" ExeCommand="for /f &quot;tokens=* delims= &quot; %a in ([MBSAMPLECOLLECTIONS]movies.txt) do (echo %a)" />
<CustomAction Id="SMC_CopyDummyMedia" Property="Cmd" ExeCommand="for /f &quot;tokens=* delims= &quot; %a in ([MBSAMPLECOLLECTIONS]movies.txt) do (copy [MBSAMPLECOLLECTIONS]dummy.avi &quot;%a&quot;\&quot;%a&quot;.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?


The obvious problems are that the way these custom actions are sequenced they won't properly support managed (elevated/UAC) instals or have any concept of servicing by MSI from a repair, rollback, uninstall, upgrade perspective.

It's hard to give exact advice without knowing exactly what you are doing. I know recently I had a customer who had an SDK with some "samples" that he wanted to instal per-user. I convinced this customer to just distribute ZIP files and write a simple winforms app that could handle asking the user a few questions and extracting these files to a directory of the users choice. This way they could deploy multiple instances of the samples, play with them, delete them, whatever without stepping on MSI's toes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜