Вопрос

Does Burn support dual-purpose (per-user or per-machine) MSI packages which were prepared according to these Microsoft guidelines?

I tried to prepare such a package, but it looks like bootstrapper created with Burn doesn't uninstall MSI package, which was installed per-machine after raising UAC privileges by End-User.

The source code for Burn is:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
       xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
  <Bundle Version="1.0" 
              Name="AppNameHere"
          UpgradeCode="GuidHere">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense" >
      <bal:WixStandardBootstrapperApplication LicenseUrl=""
                                              SuppressOptionsUI="yes" 
                                              ThemeFile="Customization\Theme.xml"
                                              LocalizationFile="Customization\LangHere.wxl"/>
    </BootstrapperApplicationRef>
    <Chain>
      <PackageGroupRef Id="WindowsInstaller45"/>
      <PackageGroupRef Id="NetFx40ClientRedist"/>  <!-- Uzywa rozszerzenia WixNetfxExtension do zainstalowania .net -->
      <PackageGroupRef Id="vcredist"/>
      <MsiPackage Compressed="yes" 
                  SourceFile="MsiFileNameHere"
                  DisplayInternalUI="yes">
        <MsiProperty Name="UPDATEDIR" Value="[UninstallPath]"/>
        <MsiProperty Name="WIXBUNDLEKEY" Value="[WixBundleProviderKey]"/>
      </MsiPackage>
        </Chain>
  </Bundle>
  <Fragment>
    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" Value="Installed" Variable="vcredistkeyx86" /> 
    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" Value="Installed" Variable="vcredistkeyx64" /> 
    <PackageGroup Id="vcredist">
        <ExePackage Id="vcredist_x86" 
                    Cache="no" 
                    Compressed="yes" 
                    PerMachine="yes" 
                    Permanent="yes" 
                    Vital="yes" 
                    SourceFile="Components\vcredist_x86.exe"
                    DetectCondition="(vcredistkeyx86 AND (vcredistkeyx86 &gt;= 1)) OR (vcredistkeyx64 AND (vcredistkeyx64 &gt;= 1))" />
    </PackageGroup>
    <PackageGroup Id="WindowsInstaller45">
      <ExePackage Cache="no" 
                  Compressed="yes" 
                  PerMachine="yes" 
                  Permanent="yes" 
                  Vital="yes"
                  SourceFile="Components\WindowsXP-KB942288-v3-x86.exe"
                  InstallCondition="VersionNT=v5.1 AND NOT VersionNT64 AND VersionMsi &lt; v4.5"
                  InstallCommand="/quiet /norestart">
        <ExitCode Behavior="forceReboot"/>
      </ExePackage>      
    </PackageGroup>
  </Fragment>  
</Wix>
Это было полезно?

Решение

As of WIX V3.9 the answer is a qualified "No" - Burn doesn't currently support dual-purpose per-user or per-machine MSI package.

A dual-purpose MSI package has the ALLUSERS property set to "2". When you build a WIX bootstrapper project referencing this type of MSI package you should see this type of warning:

2>D:\Robert\Documents\Visual Studio 2013\Projects\BurnTest\Bootstrapper\Bundle.wxs(18,0): warning LGHT1133: Bundles require a package to be either per-machine or per-user. The MSI 'D:\Robert\Documents\Visual Studio 2013\Projects\BurnTest\SetupProject\bin\Release\SetupProject.msi' ALLUSERS Property is set to '2' which may change from per-user to per-machine at install time. The Bundle will assume the package is per-machine and will not work correctly if that changes. If possible, remove the Property with Id='ALLUSERS' and use Package/@InstallScope attribute instead.

The build process for a WIX bootstrapper project will try and work out from the chained packages what type of burn installation to create (per-user or per-machine). The logic is convoluted because of the different places you can declare a preference for per-user or per-machine, and the potential conflicts between chained packages. But the general idea is the burn compiler will generate a per-machine installation, unless one of the chained packages is per-user, which will flip the burn installation into per-user mode. The key point is the decision to create a per-user or per-machine package is made at build time. To properly support dual-purpose MSI packages that decision would need to be moved to install time.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top