Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/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
WIX引导程序中.NET 4.0框架的故障检查_.net_Wix_Installation_Windows Installer_Wix Extension - Fatal编程技术网

WIX引导程序中.NET 4.0框架的故障检查

WIX引导程序中.NET 4.0框架的故障检查,.net,wix,installation,windows-installer,wix-extension,.net,Wix,Installation,Windows Installer,Wix Extension,我有一个安装Windows服务(MSI)和EXE的WIX引导程序应用程序。我一直在尝试检查是否存在.NET4.0框架作为windows服务安装程序的先决条件。我想停止安装程序,如果框架不存在,并指出他们可以下载它。当前,服务安装程序将忽略该条件,并尝试安装该服务,而不管框架是否存在 此代码段位于windows服务安装程序中: <Product Id="*" Name="TestService" Language="1033" Version="1.0.0.1" Manufacturer="

我有一个安装Windows服务(MSI)和EXE的WIX引导程序应用程序。我一直在尝试检查是否存在.NET4.0框架作为windows服务安装程序的先决条件。我想停止安装程序,如果框架不存在,并指出他们可以下载它。当前,服务安装程序将忽略该条件,并尝试安装该服务,而不管框架是否存在

此代码段位于windows服务安装程序中:

<Product Id="*" Name="TestService" Language="1033" Version="1.0.0.1" Manufacturer="xxxxxx" UpgradeCode="<xxxxxxxx">
    <PropertyRef Id="NETFRAMEWORK40FULL" />
    <Condition Message="You need to have the .NET 4.0 Framework installed">
        <![CDATA[Installed OR NETFRAMEWORK40FULL]]>
    </Condition>
</Product>

此代码段来自引导程序:

<Bundle Name="BundledInstall" Version="1.0.0.0" 
    UpgradeCode="xxxxxx">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
  <bal:WixStandardBootstrapperApplication
    LicenseFile="xxxxxxxx"
    LogoFile="xxxxxxxx"
    />
</BootstrapperApplicationRef>

<Chain>
    <PackageGroupRef Id="MyPackage" />
    <PackageGroupRef Id="ServicePackage" />
</Chain>
</Bundle> 

<Fragment>
 <PackageGroup Id="ServicePackage">
    <MsiPackage
   SourceFile="C:\Users\Max\dev\wix\pappBootstrapper\sebService.msi" Cache="no" ForcePerMachine="yes">
      </MsiPackage>
 </PackageGroup>
</Fragment>


感谢您的帮助。

您可以使用本页中定义的WixNetfxExtension属性:

例如,要检查是否安装了3.5 framework或3.5 SP,可以使用以下属性

NETFRAMEWORK35 - Set to #1 if the .NET Framework 3.5 is installed (not set otherwise).
NETFRAMEWORK35_SP_LEVEL - Indicates the service pack level for the .NET Framework 3.5.
要在项目中使用这些属性,请执行以下步骤:

第一步。将WiX.NET扩展库添加到项目中 如果您在Visual Studio中使用WiX,则可以使用“添加引用”对话框添加扩展:

  • 在Visual Studio中打开WiX项目
  • 在解决方案资源管理器中右键单击项目,然后选择“添加引用…”
  • 从列表中选择WixNetFxExtension.dll程序集,然后单击“添加”
  • 关闭“添加引用”对话框
  • 步骤2:将WiX.NET扩展名称空间添加到项目中

    <PropertyRef Id="NETFRAMEWORK20"/>
    
    将库添加到项目中后,您需要将.NET扩展命名空间添加到项目中,以便可以访问适当的WiX元素。为此,请通过添加以下属性修改项目中的顶级元素:

    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
         xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
    
    
    
    步骤3:在项目中引用所需的属性

    <PropertyRef Id="NETFRAMEWORK20"/>
    
    
    
    步骤4:在条件中使用预定义的属性

    要对照框架的service pack级别进行检查,请使用*\u SP\u级别属性。如果计算机上不存在.NET Framework 3.0 SP1,则以下条件会阻止安装

    <Condition Message="This application requires .NET Framework 3.0 SP1. Please install the .NET Framework then run this installer again.">
        <![CDATA[Installed OR (NETFRAMEWORK30_SP_LEVEL and NOT NETFRAMEWORK30_SP_LEVEL = "#0")]]>
    </Condition>
    
    
    

    来源:

    除非我弄错了,否则此解决方案只适用于产品,而不适用于捆绑包(Bootstrapper,既然你不能在bundle中使用PropertyRef,我觉得Cocowalla所说的似乎是真的。@MattLock你成功了吗?我试图使用WIX_is_NETFRAMEWORK_40_或_LATER_安装,但作为一个条件,但无论如何它总是返回false。