I was looking at this option, but I am not sure what is going on.

I created the following XSL file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi";>
        <xsl:template match="/">
                <xsl:for-each 
select="Wix/Fragment/DirectoryRef/Component/File[Source='!(wix.ImportSrc)\TestImportApp.exe']">
                        <xsl:element name="Shortcut" 
use-attribute-sets="shortcut-set" />
                </xsl:for-each>
        </xsl:template>

        <xsl:attribute-set name="shortcut-set">
                <xsl:attribute name="Id">startmenuImport</xsl:attribute>
                <xsl:attribute name="Directory">Test Import App</xsl:attribute>
                <xsl:attribute name="Name">Test1B</xsl:attribute>
                <xsl:attribute 
name="WorkingDirectory">INSTALLLOCATION</xsl:attribute>
                <xsl:attribute name="Icon"> TestImportApp.exe</xsl:attribute>
                <xsl:attribute name="IconIndex">0</xsl:attribute>
                <xsl:attribute name="Advertise">yes</xsl:attribute>
        </xsl:attribute-set>
</xsl:stylesheet>

And changed my heat call to:
heat dir "C:\Projects\TestImportApp" -dr INSTALLLOCATION -v -gg -g1 -var 
wix.ImportSrc -srd -sfrag -scom -cg cgImport -t "C:\Projects\WiX Test 
Files\test.xsl" -out "C:\Projects\WiX Test Files\wix_import_2.wxs" 

The command runs without an error, but nothing is ever generated.  If I remove 
the -t switch and value, the WXS is generated properly.

Thank you,
 
Brian Wilson
Department of Human Resources - Administrative Services
Email: brian.wil...@dhr.alabama.gov



-----Original Message-----
From: Maillet, Ed [mailto:email...@unum.com] 
Sent: Tuesday, January 18, 2011 2:42 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Modify Heat Generated Fragment with C#

Have you tried doing it with an xslt instead?
See the "-t" option.


-----Original Message-----
From: Wilson, Brian [mailto:brian.wil...@dhr.alabama.gov] 
Sent: Tuesday, January 18, 2011 3:29 PM
To: 'WiX-users@lists.sourceforge.net'
Subject: [WiX-users] Modify Heat Generated Fragment with C#

Hello,

I have a Heat generated WXS file that I am trying to modify, so I can add the 
shortcut node to the file node for my application.  I am trying to use a C# 
program to do this for me.

I am using the following code:

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"C:\Wix Files\wix_import.wxs");

XmlNode xmlWiX = xmlDoc.DocumentElement;

XmlNode xmlrplc = 
xmlWiX.SelectSingleNode(@"File[@Source='!(wix.ImportSrc)\TestImportApp.exe']");
XmlNode xmlparent = xmlrplc.ParentNode; ** Errors here***
xmlparent.RemoveChild(xmlrplc); 

xmlsrc.Save(@"~\modded_wix_import.wxs");

The attribute is not found, so I thought I would just find the node, so I tried:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"C:\Wix Files\wix_import.wxs");

XmlNode xmlWiX = xmlDoc.DocumentElement;
XmlNode xmlrplc = null;

XmlNode xmlComp = xmlWiX.SelectNodes("/Component");
XmlNodeList xmlList = xmlComp.ChildNodes; ** Errors here***

foreach (XmlNode xmlChild in xmlList)
{
        if (xmlChild.Name == "File")
        {
                if (xmlChild.Attributes["Source"].Value == 
"!(wix.ImportSrc)\TestImportApp.exe")
                {
                        xmlrplc = xmlChild;
                }
        }
}

XmlNode xmlparent = xmlrplc.ParentNode
xmlparent.RemoveChild(xmlrplc) 

xmlsrc.Save(@"~\modded_wix_import.wxs")

It seems the XML library is having a difficult time traversing the XML 
document.  Has anyone done something like this and if so, what am I doing wrong?


Thank you,
 
Brian Wilson
Department of Human Resources - Administrative Services
Email: brian.wil...@dhr.alabama.gov



------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to