Include Image in Managed Burn BootstrapperApplicat

2019-07-11 20:16发布

问题:

I'm working on an installer with wix using Burn and a custom bootstrapper application. Everything works fine, but i fail to include a simple image into my application UI.

I include the Image into my UI like this:

<Image Source="logo.jpg" Height="100" HorizontalAlignment="Center"  Margin="0,0,0,20" VerticalAlignment="Center" Width="250"/>

It shows normal in the designer. I reduced the interface to nothing but the image to exclude other possible errors.

I also added the Image as a payload in the bundle

<Payload SourceFile="..\BootstrapperApplication\logo.jpg"/>

If i start the installer the file appears in the temp folder of the installation.

I tried different approaches like adding is as a static ressource, changing the build actions for the image but cant figure out how to do it right.

回答1:

You can look at the WixBA source code to see how the WiX installer does it. It seems to embed the images as resources:

XAML:

<Image Grid.Row="0" Grid.Column="2" Source="resources\legal.png"/>

CSProj:

<ItemGroup>
  <Resource Include="Resources\exit.png" />
  <Resource Include="Resources\gear.png" />
  <Resource Include="Resources\legal.png" />
  <Resource Include="Resources\news.png" />
  <Resource Include="Resources\wrench.png" />
</ItemGroup>