我正在尝试为
Windows服务创建一个WiX安装程序,并且我已经阅读了我的所有文件,将keyPath设置为“否”,但WiX脚本中的.exe除外.
我目前正在使用Heat.exe生成我的目录和文件结构,这里是我的命令:
我目前正在使用Heat.exe生成我的目录和文件结构,这里是我的命令:
"$(WIX)bin\heat.exe" dir $(SolutionDir)EmailGenerationService\bin\PROD -cg EmailGenFiles -gg -scom -sreg -sfrag -srd -suid -dr INSTALLLOCATION -var var.FileSource -t $(Projectdir)KeyPathTransform.xslt -out $(ProjectDir)DirectoryAndFileComponents.wxs
我打算用我的DirectoryAndFileComponents.wxs文件中的Keypath =“no”更新所有文件元素.
热量输出的样本是:
<?xml version="1.0" encoding="utf-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> <DirectoryRef Id="INSTALLLOCATION"> <Component Id="Dollar.Common.dll" Guid="{2BCD0767-2383-47CF-B1BF-325FA4A3264F}"> <File Id="Dollar.Common.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.dll" /> </Component> <Component Id="Dollar.Common.Exceptions.dll" Guid="{B7238091-76D1-42F5-A3B4-A539DFF3BD92}"> <File Id="Dollar.Common.Exceptions.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.dll" /> </Component> <Component Id="Dollar.Common.Exceptions.pdb" Guid="{43711979-747D-49C9-BAE4-ECD44FAF5E67}"> <File Id="Dollar.Common.Exceptions.pdb" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.pdb" /> </Component> <Component Id="Dollar.Common.Logging.dll" Guid="{59F9ABF3-5F68-410C-BC96-0556282F1E04}"> <File Id="Dollar.Common.Logging.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Logging.dll" /> </Component>
这是XSLT,我正在热身子进行转型:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:wix="http://schemas.microsoft.com/wix/2006/wix" xmlns:my="my:my"> <xsl:output method="xml" indent="no"/> <xsl:strip-space elements="*"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match='/wix:Wix/wix:Fragment/wix:DirectoryRef/wix:Component/wix:File[@Id and not (@Id="EmailGenerationService.exe")]'> <xsl:attribute name="KeyPath"> <xsl:value-of select="no"/> </xsl:attribute> </xsl:template> </xsl:stylesheet>
我已经尝试了相当多的这个基于其他帖子在这个网站上的变体,而在哪里,但仍然无法获取由hot.exe创建的文件,以使KeyPath =“否”.
我错过了什么吗?
你有不同的定义的命名空间:
>在XML中:_ http://schemas.microsoft.com/wix/2006/wi
>在XSLT中:http://schemas.microsoft.com/wix/2006/wix
据我所知,WiX的正确命名空间是http://schemas.microsoft.com/wix/2006/wi.所以你应该纠正你的XSLT.
XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" xmlns:my="my:my"> <xsl:output method="xml" indent="yes" /> <xsl:strip-space elements="*"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match='wix:Wix/wix:Fragment/wix:DirectoryRef/wix:Component/wix:File[@Id and not (@Id = "EmailGenerationService.exe")]'> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:attribute name="KeyPath"> <xsl:text>no</xsl:text> </xsl:attribute> </xsl:copy> </xsl:template> </xsl:stylesheet>
输入XML:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> <DirectoryRef Id="INSTALLLOCATION"> <Component Id="Dollar.Common.dll" Guid="{2BCD0767-2383-47CF-B1BF-325FA4A3264F}"> <File Id="Dollar.Common.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.dll" /> </Component> <Component Id="Dollar.Common.Exceptions.dll" Guid="{B7238091-76D1-42F5-A3B4-A539DFF3BD92}"> <File Id="Dollar.Common.Exceptions.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.dll" /> </Component> <Component Id="Dollar.Common.Exceptions.pdb" Guid="{43711979-747D-49C9-BAE4-ECD44FAF5E67}"> <File Id="Dollar.Common.Exceptions.pdb" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.pdb" /> </Component> <Component Id="Dollar.Common.Logging.dll" Guid="{59F9ABF3-5F68-410C-BC96-0556282F1E04}"> <File Id="Dollar.Common.Logging.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Logging.dll" /> </Component> </DirectoryRef> </Fragment> </Wix>
输出XML:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> <DirectoryRef Id="INSTALLLOCATION"> <Component Id="Dollar.Common.dll" Guid="{2BCD0767-2383-47CF-B1BF-325FA4A3264F}"> <File Id="Dollar.Common.dll" Source="$(var.FileSource)\Dollar.Common.dll" KeyPath="no" /> </Component> <Component Id="Dollar.Common.Exceptions.dll" Guid="{B7238091-76D1-42F5-A3B4-A539DFF3BD92}"> <File Id="Dollar.Common.Exceptions.dll" Source="$(var.FileSource)\Dollar.Common.Exceptions.dll" KeyPath="no" /> </Component> <Component Id="Dollar.Common.Exceptions.pdb" Guid="{43711979-747D-49C9-BAE4-ECD44FAF5E67}"> <File Id="Dollar.Common.Exceptions.pdb" Source="$(var.FileSource)\Dollar.Common.Exceptions.pdb" KeyPath="no" /> </Component> <Component Id="Dollar.Common.Logging.dll" Guid="{59F9ABF3-5F68-410C-BC96-0556282F1E04}"> <File Id="Dollar.Common.Logging.dll" Source="$(var.FileSource)\Dollar.Common.Logging.dll" KeyPath="no" /> </Component> </DirectoryRef> </Fragment> </Wix>