检测的.NET Framework 4.5.1使用维克斯 [英] Detect .NET Framework 4.5.1 using WiX

查看:453
本文介绍了检测的.NET Framework 4.5.1使用维克斯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建使用WiX的3.8我的解决方案的安装项目。作为其中的一部分安装我创造一些发射条件,其中之一是检查的Microsoft .NET Framework 4.5.1安装。

要做到这一点,我想用一些在WixNetFxExtension LIB这似乎做工精细的旧版本的.NET框架的特性。这里是如何做到这一点的<一个例子href="http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/check_for_dotnet.html">http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/check_for_dotnet.html这并不适用于但是.NET 4.5.1的工作,因为没有NETFRAMEWORK451属性来检查。

纵观源NetFx451.wxs模块(<一href="http://wix.$c$cplex.com/SourceControl/latest#src/ext/NetFxExtension/wixlib/NetFx451.wxs">http://wix.$c$cplex.com/SourceControl/latest#src/ext/NetFxExtension/wixlib/NetFx451.wxs)似乎没有单独的财产用于.NET 4.5.1,而它也使用相同的NETFRAMEWORK45。据我了解,V4.5.1是一个in-place升级为V4.5,因此它使用相同的。注册表项(我想)反正,在该模块中,他们只是检查从NETFRAMEWORK45返回的版本号如下:

  DetectCondition =NETFRAMEWORK45&放大器; GT; = $(var.NetFx451MinRelease)
 

所以,我认为我可以只写类似如下的条件:

 &LT; PropertyRef n =NETFRAMEWORK45/&GT;
    &lt;条件消息=。在.NET Framework 4.5.1未找到停止安装&GT;
       &LT;![CDATA [安装或(NETFRAMEWORK45&GT; = 378675)]]&GT;
    &LT; /条件&gt;
 

不过,这个返回的错误消息的机器,我知道有安装.NET Framework 4.5.1上。所以,我创建了这样的条件,所以我可以只看到从注册表返回的版本号:

 &LT; PropertyRef n =NETFRAMEWORK45/&GT;
    &lt;条件信息=[NETFRAMEWORK45]&GT; 0℃/条件&gt;
 

这显示了以下文本的消息框:#378758所以,我知道,在注册表中的值是正确的。

所以我有点困惑,为什么我的病情失败。有什么明显的,我在这里失踪,或者是有一些比较在条件元素值,其他的方式?

下面是修复包含哈希符号所建议的PhilDW:

 &LT; PropertyRef n =NETFRAMEWORK45/&GT;
    &lt;条件消息=。在.NET Framework 4.5.1未找到停止安装&GT;
      &LT;![CDATA [安装或(NETFRAMEWORK45&GT; =#378675)]]&GT;
    &LT; /条件&gt;
 

解决方案

您正在包括#的比较,这不会帮助。您是否尝试过包括#在CDATA比较呢?

我会假设,当微软发布人code例子来检测架构的版本不能与MSI文件的简单RegistrySearch完成。

http://blogs.msdn.com/ B / astebner /存档/十分之二千零一十三/ 17 / 10457758.aspx

I'm creating an installer project in my solution using WiX 3.8. As part of this install I create some launch conditions, one of which is checking that Microsoft .NET Framework 4.5.1 is installed.

To do this I want to use some of the properties in the WixNetFxExtension lib which seem to work fine for older versions of the .NET framework. There is an example of how to do this on http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/check_for_dotnet.html This doesn't work for .NET 4.5.1 however as there is no NETFRAMEWORK451 property to check.

Looking at the source for the NetFx451.wxs module (http://wix.codeplex.com/SourceControl/latest#src/ext/NetFxExtension/wixlib/NetFx451.wxs) it appears that there is no separate property to use for .NET 4.5.1, but rather it also uses the same NETFRAMEWORK45. As I understand it, v4.5.1 is an in-place upgrade for v4.5, so it uses the same registry keys (I think). Anyway, in that module, they simply check the version number returned from NETFRAMEWORK45 as follows:

DetectCondition="NETFRAMEWORK45 &gt;= $(var.NetFx451MinRelease)"

So I assumed that I could just write a condition like the following:

    <PropertyRef Id="NETFRAMEWORK45" />
    <Condition Message="The .NET Framework 4.5.1 was not found.  Stopping installation.">
       <![CDATA[Installed OR (NETFRAMEWORK45 >= 378675)]]>
    </Condition>

But, this returned the error message on a machine that I know has the .NET Framework 4.5.1 installed. So I created a condition like this so I could just see the version number being returned from the registry:

    <PropertyRef Id="NETFRAMEWORK45" />
    <Condition Message ="[NETFRAMEWORK45]">0</Condition>

This shows a message box with the following text: #378758 So I know that the value in the registry is correct.

So I am a bit confused why my condition failed. Is there something obvious I am missing here, or is there some other way to compare that value in the condition element?

Here is the fix to include the hash symbol as suggested by PhilDW:

    <PropertyRef Id="NETFRAMEWORK45" />
    <Condition Message="The .NET Framework 4.5.1 was not found.  Stopping installation.">
      <![CDATA[Installed OR (NETFRAMEWORK45 >= "#378675")]]>
    </Condition>

解决方案

You're including that # in the comparison, that's not going to help. Have you tried including the # in your CDATA comparison?

I would assume that when Microsoft people post code examples to detect framework versions it can't be done with a simple RegistrySearch in an MSI file.

http://blogs.msdn.com/b/astebner/archive/2013/10/17/10457758.aspx

这篇关于检测的.NET Framework 4.5.1使用维克斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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