构建面向 x64 的 WiX 3.6 项目? [英] Build WiX 3.6 project targeting x64?

查看:26
本文介绍了构建面向 x64 的 WiX 3.6 项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的解决方案是使用平台设置任何 CPU"构建的.对于我的 WiX 3.6 安装程序项目设置,我似乎无法将目标平台设置为"x64";只有x86"可用.可以针对 x64 构建 WiX 项目吗?

My solution is built with platform setting "Any CPU". For my WiX 3.6 installer project settings, it seems that I can't set the target platform to "x64"; only "x86" is available. Can the WiX project be built targeting x64?

推荐答案

Windows 安装程序无法针对 Any CPU 构建,我通常构建两次,托管代码设置为 Any CPU,而安装程序有两种配置 x86 和x64.

Windows installers cannot be built to target Any CPU, I typically build twice, with the managed code being set to Any CPU, whilst the installer has two configurations x86 and x64.

您可能会发现需要创建配置,这可以通过右键单击解决方案并选择配置管理器然后选择平台下的下拉菜单来完成.完成后,您应该能够看到 wixproj 中定义的以下内容:

You may find you need to create the configurations, this can be done by right clicking on the solution and selecting configuration manager then selecting the drop down under platform. When you're complete you should be able to see the following defined in your wixproj:

  <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>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    <DefineConstants>Debug</DefineConstants>
    <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
  </PropertyGroup>

为了允许安装程序同时使用 x86 和 x64,定义变量来检测和设置安装的架构.

To allow the installer to work with both x86 and x64 define variables to detect and set the architecture of the install.

<?if $(var.Platform) = x64 ?>
<?define bitness = "(64 bit)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define bitness = "(32 bit)" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>

我将 bitness 变量附加到名称作为视觉线索:

I append the bitness variable to the name as a visual clue:

<Product Name="My Install $(var.bitness)"

请参阅程序文件适当的文件夹:

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="$(var.PlatformProgramFilesFolder)">

组件正确设置了 Win64 标志:

Components have the Win64 flag set appropriately:

<Component Win64="$(var.Win64)"

这篇关于构建面向 x64 的 WiX 3.6 项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆