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
如何在WiX安装程序中添加应用程序作为防火墙例外_Wix_Windows Installer_Wix3.7_Wix Extension - Fatal编程技术网

如何在WiX安装程序中添加应用程序作为防火墙例外

如何在WiX安装程序中添加应用程序作为防火墙例外,wix,windows-installer,wix3.7,wix-extension,Wix,Windows Installer,Wix3.7,Wix Extension,我有一个需要安装大量文件的安装程序。我正在使用heat.exe获取所有文件。这个heat命令实际上是我的构建脚本的一部分,后面跟着其他命令,比如Candle.exe和light.exe。现在,我的应用程序test.exe也会自动生成GUID和组件ID。如何将此特定应用程序添加为防火墙例外。问题是每次我使用脚本构建安装程序时,都会生成一个带有新组件ID的新收获文件。有什么建议吗 heat接受XSL转换参数,以您需要的任何方式修改其输出。简单的XSL样式表可以将元素添加到通过XPath选择的特定文件

我有一个需要安装大量文件的安装程序。我正在使用heat.exe获取所有文件。这个heat命令实际上是我的构建脚本的一部分,后面跟着其他命令,比如Candle.exe和light.exe。现在,我的应用程序test.exe也会自动生成GUID和组件ID。如何将此特定应用程序添加为防火墙例外。问题是每次我使用脚本构建安装程序时,都会生成一个带有新组件ID的新收获文件。有什么建议吗

heat
接受XSL转换参数,以您需要的任何方式修改其输出。简单的XSL样式表可以将元素添加到通过XPath选择的特定
文件
元素中

这假设在
heat
运行中只有
test.exe
。如果不是这样,请在
match
属性中修改XPath:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:wix='http://schemas.microsoft.com/wix/2006/wi'
    xmlns:fire='http://schemas.microsoft.com/wix/FirewallExtension'
    xmlns='http://schemas.microsoft.com/wix/2006/wi'
    exclude-result-prefixes='wix'
    >
  <xsl:output method="xml" indent="yes" />

  <xsl:template match="//wix:File[contains(@Source,'\test.exe')]">
    <wix:File>
      <xsl:copy-of select="@*" />
      <fire:FirewallException Id='test.exe' Name='Test Server' IgnoreFailure='yes'>
        <xsl:comment> localhost won't work here </xsl:comment>
        <fire:RemoteAddress>127.0.0.1</fire:RemoteAddress>
      </fire:FirewallException>
      <xsl:apply-templates select="node()" />
    </wix:File>
  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

  <xsl:template match="/">
    <xsl:comment>!!!DO NOT EDIT!!! Generated by heat.exe and FirewallExceptions added.</xsl:comment>
      <xsl:apply-templates />
  </xsl:template>

</xsl:stylesheet> 

localhost在这里不起作用
127.0.0.1
!!!不要编辑!!!由heat.exe生成,并添加FirewallException。

heat
接受XSL转换参数,以您需要的任何方式修改其输出。简单的XSL样式表可以将元素添加到通过XPath选择的特定
文件
元素中

这假设在
heat
运行中只有
test.exe
。如果不是这样,请在
match
属性中修改XPath:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:wix='http://schemas.microsoft.com/wix/2006/wi'
    xmlns:fire='http://schemas.microsoft.com/wix/FirewallExtension'
    xmlns='http://schemas.microsoft.com/wix/2006/wi'
    exclude-result-prefixes='wix'
    >
  <xsl:output method="xml" indent="yes" />

  <xsl:template match="//wix:File[contains(@Source,'\test.exe')]">
    <wix:File>
      <xsl:copy-of select="@*" />
      <fire:FirewallException Id='test.exe' Name='Test Server' IgnoreFailure='yes'>
        <xsl:comment> localhost won't work here </xsl:comment>
        <fire:RemoteAddress>127.0.0.1</fire:RemoteAddress>
      </fire:FirewallException>
      <xsl:apply-templates select="node()" />
    </wix:File>
  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

  <xsl:template match="/">
    <xsl:comment>!!!DO NOT EDIT!!! Generated by heat.exe and FirewallExceptions added.</xsl:comment>
      <xsl:apply-templates />
  </xsl:template>

</xsl:stylesheet> 

localhost在这里不起作用
127.0.0.1
!!!不要编辑!!!由heat.exe生成,并添加FirewallException。

您不能使用
netsh advfirewall fitewall add将自定义操作添加为脚本吗?
如前所述,实际上我正在考虑尝试WiXFirewallExtension。在您的情况下,文件ID是否稳定?在这种情况下,您确实可以使用该扩展。这就是问题所在。实际上,磁场是不稳定的。Heat是指包含所有要安装的文件的文件夹。而应用程序正处于某个变化阶段,所以每次源目录中都会有不同版本的应用程序。难道你不能用
netsh advfirewall fitewall add
添加自定义操作作为脚本吗?就像上面描述的,实际上我正在考虑尝试WiXFirewallExtension。在您的情况下,文件ID是否稳定?在这种情况下,您确实可以使用该扩展。这就是问题所在。实际上,磁场是不稳定的。Heat是指包含所有要安装的文件的文件夹。而应用程序正处于某个变化阶段,所以每次源目录中都会出现不同版本的应用程序,这就是问题所在。我正在处理下面文件的输出,不要让放置XML名称空间前缀声明(xmlns:…)打扰您;XSL处理器可以将它们放在与输出文档具有相同语义的任何位置。如果您认为其他方面有问题,请在您的问题中发布该输出,它在评论中被损坏和/或不完整。有问题。我正在处理下面文件的输出,不要让放置XML名称空间前缀声明(xmlns:…)打扰您;XSL处理器可以将它们放在与输出文档具有相同语义的任何位置。如果您认为有其他错误,请在您的问题中发布该输出,因为它在评论中被损坏和/或不完整。