构建针对x64的WiX 3.6项目?

sea*_*717 21 wix

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

Dav*_*tin 35

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

您可能会发现需要创建配置,这可以通过右键单击解决方案并选择配置管理器然后选择平台下的下拉菜单来完成.完成后,您应该能够看到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>
Run Code Online (Sandbox Code Playgroud)

允许安装程序使用x86和x64定义变量来检测和设置安装的体系结构.

<?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 ?>
Run Code Online (Sandbox Code Playgroud)

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

<Product Name="My Install $(var.bitness)"
Run Code Online (Sandbox Code Playgroud)

请参阅Program Files文件夹:

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="$(var.PlatformProgramFilesFolder)">
Run Code Online (Sandbox Code Playgroud)

组件适当地设置Win64标志:

<Component Win64="$(var.Win64)"
Run Code Online (Sandbox Code Playgroud)

  • 这对我有帮助——无论我从 GUI 尝试什么,我都无法让 Wix 安装程序项目构建 x64 版本。我在记事本中打开了项目文件,看到有几个重复的条目。删除 x64 和 x86 的重复条目后,我重新打开了项目并能够构建 64 位安装程序 (3认同)