[wix-users] Install Service with Harvested Files

Gary M garym at oedata.com
Sat Apr 30 05:58:04 PDT 2016


I created a XSLT 1.0 file to remove a specific file, it's parent component,
and the component references from the heat output file.

Replace the text "unwanted.file" with the file name you want removed.
After, you can reference the file using the wix:File tag the file in the
service(s) wix:Component tag.

The heat options are -gg, -ke, -srd, -sfrag, -cg..  WARNING: This script
will likely not work  if you change the heat output format and tree
options. But it gives you a starting point.


<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : filter-unwanted-file.xsl
    Created on : April 29, 2016, 4:55 PM
    Author     : garym
    Description:
        Remove 'unwanted.file', the parent component, and the component
references from the harvest.
-->

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">

  <!-- Some formatting stuff to keep it readable -->
  <xsl:output method="html"/>
  <xsl:preserve-space elements="*" />
  <!-- Copy all attributes and elements to the output. -->
  <xsl:template match="@*|*">
    <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates select="*" />
    </xsl:copy>
  </xsl:template>
  <!-- Preserve the indents -->
  <xsl:output method="xml" indent="yes" />

  <!--
   ***  This is where our stuff begins ***
  -->

  <!-- The name of the file to remove from the heat gererated file -->
  <xsl:variable name="toRemove">php.exe</xsl:variable>

  <!-- Define the key containing the Id for the file element to remove. -->
  <!-- XSLT 2.0 <xsl:key name="file-element-id"
match="wix:File[@Source[ends-with(name(),'unwanted.file')]" use="@Id" /> -->
  <xsl:key name="file-element-id" match="wix:File[substring(@Source,
string-length(@Source) - string-length('unwanted.file') +1) =
'unwanted.file' ]" use="@Id" />
  <!-- Define the key containing the Id for the file element parent
component to remove. -->
  <!-- XSLT 2.0 <xsl:key name="file-element-component-id"
match="wix:File[@Source[ends-with(name(),'unwanted.file)]"
use="parent::*/@Id" /> -->
   <xsl:key name="file-element-component-id"
match="wix:File[substring(@Source, string-length(@Source) -
string-length('unwanted.file') +1) = 'unwanted.file' ]" use="parent::*/@Id"
/>

  <!-- Remove the file element -->
  <xsl:template match="wix:File[key('file-element-id', @Id)]" />
  <!-- Remove the parent component element -->
   <xsl:template match="wix:Component[key('file-element-component-id',
@Id)]" />
  <!-- Remove ComponentRefs referencing of the component(s). -->
  <xsl:template match="wix:ComponentRef[key('file-element-component-id',
@Id)]" />
</xsl:stylesheet>




On Fri, Apr 29, 2016 at 5:01 PM, Gary M <garym at oedata.com> wrote:

> In case anyone else is interested, I just posted a similar question on
> stackoverflow:
> http://stackoverflow.com/questions/36948436/wix-how-to-reference-an-external-file-for-serviceinstall-binary
>
> On Fri, Apr 29, 2016 at 4:12 PM, Gary M <garym at oedata.com> wrote:
>
>> I think this a the problem I'm work on at this moment.
>>
>> I'm using the xslt method outlined here:
>> http://stackoverflow.com/questions/6813415/ignoring-svn-directories-with-wix-heat
>>
>> The xslt filters out the duplicate from the heat harvest. Then you can
>> reference the file in the service component.
>>
>> I'll post code later..
>>
>>
>> On Fri, Apr 29, 2016 at 10:06 AM, Stephens, Rich <
>> RStephens at bottomline.com> wrote:
>>
>>>
>>> http://codeblog.vurdalakov.net/2013/06/wix-how-to-install-and-start-windows-service.html
>>>
>>> Rich Stephens  |  Bottomline Technologies
>>> 770-576-3623  |  rstephens at bottomline.com
>>>
>>>
>>> -----Original Message-----
>>> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On
>>> Behalf Of Michael Kolowicz
>>> Sent: Friday, April 29, 2016 12:03 PM
>>> To: wix-users at lists.wixtoolset.org
>>> Subject: [wix-users] Install Service with Harvested Files
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hello,
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> I using WiX 3.10.2 with VS2015. I have create a Installer Project and
>>> using the Harvested method for creation my package. Everytime I build the
>>> package, the files they be included will be create
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Now I need a way to install a service. How can I do it?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Freundliche Grüße / Best regards
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Michael Kolowicz
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Systementwickler
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ____________________________________________________________________
>>> WiX Toolset Users Mailing List provided by FireGiant
>>> http://www.firegiant.com/
>>>
>>> ____________________________________________________________________
>>> WiX Toolset Users Mailing List provided by FireGiant
>>> http://www.firegiant.com/
>>>
>>
>>
>



More information about the wix-users mailing list