Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 在安装插件之前检查产品_Windows_Wix_Installation - Fatal编程技术网

Windows 在安装插件之前检查产品

Windows 在安装插件之前检查产品,windows,wix,installation,Windows,Wix,Installation,我不熟悉Windows Installer XML(WIX工具集)。我想知道我的程序是32位版本还是64位版本。我知道这一点的唯一方法(我所知不多)是在program files目录中搜索这两个属性(下面)并查看该程序是否存在(我会检查注册表,但该程序的安装程序不使用windows注册表) 然后检查这些条件 <!--Check for installation--> <Condition Message="ImageJ is not installed for a 32-b

我不熟悉Windows Installer XML(WIX工具集)。我想知道我的程序是32位版本还是64位版本。我知道这一点的唯一方法(我所知不多)是在program files目录中搜索这两个属性(下面)并查看该程序是否存在(我会检查注册表,但该程序的安装程序不使用windows注册表)


然后检查这些条件

<!--Check for installation-->
<Condition Message="ImageJ is not installed for a 32-bit operating system. You have ImageJ installed with its 64-bit version. Please install this Plugin using the 64-bit version: (URL for 64-bit installer)">
  <![CDATA[Installed OR NOT IMAGEJINSTALLED64 OR IMAGEJINSTALLED32]]>
</Condition>
<Feature Id="CopyFiles" 
         Title="Plugin Installer for ImageJ" Level="1"
         Absent="disallow" AllowAdvertise="no">
  <!--Will run the necessary parts to install the plugin (by copying files to the right directory)-->
</Feature>

当我运行这个程序时,它会检查ImageJ是否只安装在32位程序文件中,而不安装在64位程序文件中。如果此检查为真,则将安装插件。这几乎就是我想要的

我真正需要知道的是如何处理这两个条件(以及我已经解决的两个条件): 1) 如果用户已安装32位和64位的程序 2) 如果用户根本没有安装程序


我尝试过多种情况,但似乎不起作用。

搜索文件位置以检测应用程序位可能有问题。这是因为进行检查的应用程序也将具有位性(影响路径重定向),因此从32位安装程序中,您将无法访问64位文件路径,或者以其他方式访问


一个更简单的方法是创建一个(我假设您有两个不同的安装程序,一个用于32位机器,另一个用于64位机器)。如果您有两个不同的安装程序,那么您也应该有两个唯一的安装程序。

谢谢。这听起来简单多了。我查了你提供的链接。你能举个例子说明怎么做吗?我只是不知道如何正确使用ProductSearch(因为我不知道将什么放入ProductCode或UpgradeCode属性中——无论选择哪一个)。请注意,我没有为这个程序创建安装程序。我只是创建这个插件安装程序。是的,有两个不同的安装程序,所以会有两个产品代码。我只是不知道如何找到产品代码。产品代码是GUID。如果您使用类似SuperRCA()的工具打开安装程序,您可以从安装程序处获得它。只需转到属性表并查找包含ProductCode的行。WiX没有ProductCode搜索(在Windows Installer中也没有),尽管有一个util product code搜索。您可以使用upgradecode元素搜索upgradecode值(对于不同的位,该值应该不同),该UpgradeVersion元素只有一个检测到upgradecode的yes,如果检测到该upgradecode,则设置一个属性。该程序的文件似乎是EXE文件。我使用了一个EXE到MSI的转换器,找到了productCode和UpgradeCode。对于32位和64位,代码是相同的(相同的产品代码,然后是相同的升级代码)。这很普遍吗?(我想不会)创建一个新的安装程序对我来说更好吗,或者其他建议?
<!--Check for installation-->
<Condition Message="ImageJ is not installed for a 32-bit operating system. You have ImageJ installed with its 64-bit version. Please install this Plugin using the 64-bit version: (URL for 64-bit installer)">
  <![CDATA[Installed OR NOT IMAGEJINSTALLED64 OR IMAGEJINSTALLED32]]>
</Condition>
<Feature Id="CopyFiles" 
         Title="Plugin Installer for ImageJ" Level="1"
         Absent="disallow" AllowAdvertise="no">
  <!--Will run the necessary parts to install the plugin (by copying files to the right directory)-->
</Feature>