我想用我的应用程序安装Visual C ++ 2012重新分发。我想根据机器的架构安装适当的版本。例如
if platfrom is x86
vcredist_filename = Microsoft_VC120_CRT_x86.ms
else
vcredist_filename = Microsoft_VC120_CRT_x64.ms
我试图以许多不同的方式完成,但我不能让它工作。我尝试了什么:
<?if $(var.Platform) = x64 ?>
<?define VC120Redist_FileName="Microsoft_VC120_CRT_x64.msm" ?>
<?else ?>
<?define VC120Redist_FileName="Microsoft_VC120_CRT_x86.msm" ?>
<?endif ?>
(undefined preprocesss variable "Platform").
<?if $(var.VersionNT64) ?>
<?define VC120Redist_FileName="Microsoft_VC120_CRT_x64.msm" ?>
<?else ?>
<?define VC120Redist_FileName="Microsoft_VC120_CRT_x8.msm" ?>
<?endif ?>
(undefined preprocesss variable "VersionNT64").
<?if ![CDATA[VersionNT64]] ?>
<?define VC120Redist_FileName="Microsoft_VC120_CRT_x64.msm" ?>
<?endif?>
(unexpected literal ![CDATA[VersionNT64]])
答案 0 :(得分:1)
我可能会使用两个单独的组件,条件如下:
<Component Id="Foo" Guid="{GUID}" Win64="yes">
<Condition>
<![CDATA[VersionNT64 OR $(var.Platform) = "x64"]]>
</Condition>
</Component>
<Component Id="Bar" Guid="{GUID}">
<Condition>
<![CDATA[NOT(VersionNT64) OR $(var.Platform) = "x86"]]>
</Condition>
</Component>