在Wix中,如何在属性中获取注册表项值的子字符串? [英] In Wix , How to get substring of registry key value in a property?

查看:111
本文介绍了在Wix中,如何在属性中获取注册表项值的子字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序部署中,我们正在验证在一台计算机中安装了哪个版本的excel客户端。有些时候,如果安装了多个版本,那么我们试图获得最新的版本的excel然后安装我们的加载项。



我们需要获取Excel的最新版本号才能在注册表中进行搜索。



以下注册表


HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel .Application\CurVer


这为Excel 2016的价值为



< blockquote>

Excel.Application.16


如何将16号单独从属性中获取?我们必须得到这个,因为如果安装了excel 2010或更高版本,我们必须安装我们的Msi。

解决方案

而不是阅读注册表然后使用字符串值,您可以对excel组件ID进行组件搜索,这是一个更强大的技术:



请在下面找到其他Excel的组件ID版本。


  1. Excel 2007组件ID:{0638C49D-BB8B-4CD1-B191-052E8F325736}

  2. Excel 2010 x86:{538F6C89-2AD5-4006-8154-C6670774E980}

  3. Excel 2010 x64:{8B1BF0B4-A1CA-4656-AA46-D11C50BC55A4}

  4. Excel 2013 x86:{C8A65ABE-3270-4FD7-B854-50C8082C8F39}

  5. Excel 2013 x64:{E3BD1151-B9CA-4D45-A77E-51A6E0ED322A}

  6. Excel 2016 x86:{C845E028-E091-442E-8202-21F596C559A0}

  7. Excel 2016 x64:{C4ACE6DB-AA99-401F-8BE6-8784BD09F003}

希望有帮助!



编辑:你可以这样做: p>

 < Property Id =EXCEL2016Search> 
< ComponentSearch Id =DetectExcel1Guid ={C4ACE6DB-AA99-401F-8BE6-8784BD09F003}Type =file/>
< / Property>

< Property Id =EXCEL2013Search>
< ComponentSearch Id =DetectExcel2Guid ={E3BD1151-B9CA-4D45-A77E-51A6E0ED322A}Type =file/>
< / Property>

<属性Id =EXCEL2010Search>
< ComponentSearch Id =DetectExcel3Guid ={8B1BF0B4-A1CA-4656-AA46-D11C50BC55A4}Type =file/>
< / Property>

<属性Id =EXCELVersionValue =0/>

< SetProperty Id =EXCELVersionAfter =DetectExcel3Value =1Sequence =first>
< [CDATA [EXCEL2016Search OR EXCEL2013Search OR EXCEL2010Search]]>
< / SetProperty>

如果属性EXCELVersion的值为1,则安装Excel 2010或更高版本。如果为0,则不安装excel 2010或以上版本。


In my application deployment we are verifying which version of excel client is installed in a machine.

Some times if multiple versions are installed then we are trying to get latest version of excel then install our add-in .

we need to get the latest version number of Excel to search in registry.

Following registry

"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Application\CurVer"

which is giving value for Excel 2016 as

Excel.Application.16

How to get the number 16 alone from this into property? We have to get this because we have to install our Msi if excel 2010 or above is installed.

解决方案

Instead of reading the registry and then playing with the string value, you can do a component search for the excel component ID which is a more robust technique:

Please find below the component ID for other Excel versions.

  1. Excel 2007 Component ID: {0638C49D-BB8B-4CD1-B191-052E8F325736}
  2. Excel 2010 x86: {538F6C89-2AD5-4006-8154-C6670774E980}
  3. Excel 2010 x64: {8B1BF0B4-A1CA-4656-AA46-D11C50BC55A4}
  4. Excel 2013 x86: {C8A65ABE-3270-4FD7-B854-50C8082C8F39}
  5. Excel 2013 x64: {E3BD1151-B9CA-4D45-A77E-51A6E0ED322A}
  6. Excel 2016 x86: {C845E028-E091-442E-8202-21F596C559A0}
  7. Excel 2016 x64: {C4ACE6DB-AA99-401F-8BE6-8784BD09F003}

Hope that helps!

EDIT: You can do something like this:

    <Property Id="EXCEL2016Search">
              <ComponentSearch Id="DetectExcel1" Guid="{C4ACE6DB-AA99-401F-8BE6-8784BD09F003}" Type="file"/>
            </Property>

<Property Id="EXCEL2013Search">
          <ComponentSearch Id="DetectExcel2" Guid="{E3BD1151-B9CA-4D45-A77E-51A6E0ED322A}" Type="file"/>
        </Property>

<Property Id="EXCEL2010Search">
          <ComponentSearch Id="DetectExcel3" Guid="{8B1BF0B4-A1CA-4656-AA46-D11C50BC55A4}" Type="file"/>
        </Property>

    <Property Id="EXCELVersion" Value="0" />

    <SetProperty Id="EXCELVersion" After="DetectExcel3" Value="1" Sequence="first" >
      <[CDATA[EXCEL2016Search OR EXCEL2013Search OR EXCEL2010Search]]>
    </SetProperty>

If the value of the property "EXCELVersion" is 1 then Excel 2010 or above is installed. If it is 0, then excel 2010 or above is not installed.

这篇关于在Wix中,如何在属性中获取注册表项值的子字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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