检测是 32 位还是 64 位 windows 并定义 var
Detect if 32 or 64 bit windows and define var
我想在我的应用程序中安装 Visual C++ 2012 redistribute。我想根据机器的架构安装合适的版本。例如
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]])
我可能会使用两个单独的组件,条件如下:
<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>
我想在我的应用程序中安装 Visual C++ 2012 redistribute。我想根据机器的架构安装合适的版本。例如
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]])
我可能会使用两个单独的组件,条件如下:
<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>