WiX で生成された msi にマニフェストを適用して、インストーラーの実行時にすぐに UAC プロンプトを表示する exe を作成しようとしています。残念ながら、インストーラー プロジェクトのビルド時に次のエラーが発生します。
Values of attribute "level" not equal in different manifest snippets. mt.exe
InstallUISequence 中に実行されるカスタム アクションが管理者権限を持つ (IIS アプリ プールと Web アプリを検索する) ことができるように、実行を昇格する必要があります。Windows 8 で Visual Studio 2012 を使用しています。
以下は、ブートストラップのセットアップを示す wixproj ファイルです。
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.5</ProductVersion>
<ProjectGuid>{d51029e8-4a79-4812-96e1-bf6b600d5d34}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>WixInstallerExampleWebInstaller</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="IisSettingsDlg.wxs" />
<Compile Include="Product.wxs" />
<Compile Include="UserInterface.wxs" />
<Compile Include="WixInstallerExampleWeb.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WixInstallerExampleWeb\WixInstallerExampleWeb.csproj">
<Name>WixInstallerExampleWeb</Name>
<Project>{d23a374d-764c-40ba-b566-4d7c55319236}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLLOCATION</RefTargetDir>
<PackageThisProject>True</PackageThisProject>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
<WixExtension Include="WixNetFxExtension">
<HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
<Name>WixNetFxExtension</Name>
</WixExtension>
<WixExtension Include="WixIIsExtension">
<HintPath>$(WixExtDir)\WixIIsExtension.dll</HintPath>
<Name>WixIIsExtension</Name>
</WixExtension>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<Content Include="EULA.rtf" />
<Content Include="IisManager.CA.dll" />
<Content Include="uac.manifest" />
</ItemGroup>
<ItemGroup>
<BootstrapperFile Include="Microsoft.Windows.Installer.3.1" >
<ProductName>Windows Installer 3.1</ProductName>
</BootstrapperFile>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<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="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper" />
</Target>
<Target Name="PatchSetupExe" DependsOnTargets="Bootstrapper">
<Exec Command='"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\bin\mt.exe" -manifest "$(ProjectDir)uac.manifest" -updateresource:"$(ProjectDir)$(OutputPath)Setup.exe;#1"' IgnoreExitCode='false' />
</Target>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets" />
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);Bootstrapper;PatchSetupExe</BuildDependsOn>
</PropertyGroup>
<Target Name="BeforeBuild">
<MSBuild Projects="%(ProjectReference.FullPath)" Targets="Package" Properties="Configuration=$(Configuration);Platform=AnyCPU" Condition="'%(ProjectReference.PackageThisProject)'=='True'" />
<Copy SourceFiles="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\TransformWebConfig\transformed\web.config" OverwriteReadOnlyFiles="true" DestinationFolder="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" Condition="'%(ProjectReference.PackageThisProject)'=='True'" />
<PropertyGroup>
<LinkerBaseInputPaths>%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\</LinkerBaseInputPaths>
<DefineConstants>BasePath=%(ProjectReference.RootDir)%(ProjectReference.Directory);</DefineConstants>
</PropertyGroup>
<HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" DirectoryRefId="INSTALLLOCATION" ComponentGroupName="%(ProjectReference.Filename)_Project" SuppressCom="true" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" AutoGenerateGuids="false" GenerateGuidsNow="true" ToolPath="$(WixToolPath)" Condition="'%(ProjectReference.PackageThisProject)'=='True'" PreprocessorVariable="var.BasePath" />
</Target>
<PropertyGroup>
<PreBuildEvent />
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent />
</PropertyGroup>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="AfterBuild">
</Target>
-->
</Project>
そして、これが私が適用しようとしている私のマニフェストファイルです:
<?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>