WiX と DTF: ブートストラッパーを使用して、Vista で昇格された特権を強制する を参照して、昇格した msi 全体を実行する方法を確認してください。
GenerateBootstrapper タスクを使用して、.wixproj ファイルでこれを自動化できます。要約する:
次のように setup.manifest を作成します。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="Setup" type="win32" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
.wixproj ファイルを次のように変更します。
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- standard PropertyGroups and ItemGroups -->
<PropertyGroup>
<WindowsSDK>$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder)</WindowsSDK>
</PropertyGroup>
<PropertyGroup Condition="$(WindowsSDK) == ''">
<WindowsSDK>$(registry:HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder)</WindowsSDK>
</PropertyGroup>
<PropertyGroup>
<mt_exe>$(WindowsSDK)bin\mt.exe</mt_exe>
</PropertyGroup>
<ItemGroup>
<BootstrapperFile Include="Microsoft.Windows.Installer.3.1" >
<ProductName>Windows Installer 3.1</ProductName>
</BootstrapperFile>
<!-- more BootstrapperFile items -->
</ItemGroup>
<Target Name="Bootstrapper"
Inputs="$(OutDir)$(TargetFileName)"
Outputs="$(OutDir)\Setup.exe"
Condition=" '$(OutputType)'=='package' " >
<GenerateBootstrapper ApplicationName="application name"
ApplicationFile="$(TargetFileName)"
BootstrapperItems="@(BootstrapperFile)"
ComponentsLocation="Relative"
OutputPath="$(OutputPath)"
Culture="en-US"
Path="$(WindowsSDK)\Bootstrapper" />
</Target>
<Target Name="PatchSetupExe" DependsOnTargets="Bootstrapper">
<Exec Command='"$(mt_exe)" -manifest setup.manifest -outputresource:$(OutDir)\Setup.exe;#1' IgnoreExitCode='false' />
</Target>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WiX\v3.0\Wix.targets" />
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);Bootstrapper;PatchSetupExe</BuildDependsOn>
</PropertyGroup>
</Project>
これで、管理者特権で実行される正しい setup.exe がビルドごとに生成されます。