开发者

WiX MSI and EXE as one EXE

I have a WiX 3.0 MSI file that runs at the end of the install the application it installs, as this application is running as a custom action (and u开发者_如何学Pythonses the session passed by the installer for some stuff, like writing logs..).

I need to make this install run with elevated permissions, and so I have created a "bootsrap" that runs as administrator and run this MSI file - as well as passes it the path to the log file.

I am searching for a way to pack this MSI and EXE into one EXE to distribute. I prefer doing it as part of my Visual studio project. Is it possible? If so, how?


You may be able to embed it into the custom action and then extract it and save it to disk at runtime.

For more information, see the article Insert any binary file in C# assembly and extract it at runtime.


There are many tools for building self-extracting executables, and Wikipedia lists several of the popular ones. We ended up using WinRAR in a post-build step in MSBuild for this task.

<Target Name="AfterBuild">
    <GenerateBootstrapper
          ApplicationFile="$(OutputName).msi"
          ApplicationName="$(ProductName)"
          BootstrapperItems="@(BootstrapperFile)"
          OutputPath="$(OutputPath)"
          ComponentsLocation="Relative"
          CopyComponents="true"
          Culture="en"
          Path="$(ProductRoot)\Deployment"/>

    <ConvertToAbsolutePath Paths="$(IconFile)">
        <Output TaskParameter="AbsolutePaths" PropertyName="IconFile"/>
    </ConvertToAbsolutePath>

    <ConvertToAbsolutePath Paths="$(BannerFile)">
        <Output TaskParameter="AbsolutePaths" PropertyName="BannerFile"/>
    </ConvertToAbsolutePath>

    <!--  a      Adds files to archive -->
    <!--  -m     Sets compression level (0-store...3-default...5-maximal) -->
    <!--  -sfx   Sets self-extracting mode -->
    <!--  -ep1   Exclude base directory from included file paths -->
    <!--  -r     Add files recursively -->
    <!--  -iadm  Request administrator rights -->
    <!--  -z     Specify sfx configuration file -->
    <!--  -iicon<icon.ico>  Specify icon to use -->
    <!--  -iimg<banner.bmp>  Specify splash banner to use -->
    <Exec Command='$(ProductRoot)\..\buildTools\WinRAR\winrar.exe a -m3 -sfx -ep1 -r -iadm -iicon$(IconFile) -iimg$(BannerFile) -zsfx_config.txt $(OutputPath)\$(OutputSetupName) $(TargetPath) $(OutputPath)\setup.exe "$(BootstrapperDependency)"'/>
</Target>

In WiX 3.6, Burn should be able to handle that task, but I haven't experimented with it yet.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜