Wix code for Windows service

by sunil ravulapalli /20. September 2014 05:22 /wix /Comments (0)
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <?define ProductManufacturer="Company Financial" ?>
  <?define ProductName="Company Decisioning Service" ?>
  <?define UpgradeCode="0905ba53-804e-4fb4-af5e-5e21cca3b0b0" ?>
  <Product Name="$(var.ProductName)" Id="*" UpgradeCode="$(var.UpgradeCode)" Manufacturer="$(var.ProductManufacturer)" Version="$(var.ProductVersion)" Language="1033">
    <Package Manufacturer="$(var.ProductManufacturer)" InstallerVersion="200" Languages="1033" Compressed="yes" />
    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
    <UIRef Id="WixUI_InstallDir" />
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
    <WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
    <WixVariable Id="WixUIBannerBmp" Value="Company_banner.jpg" />
    <WixVariable Id="WixUIDialogBmp" Value="Company_dialog.jpg" />

    <Property Id="ARPPRODUCTICON" Value="Company.ico" />
    <Icon Id="Company.ico" SourceFile="Company.ico" />
    
    <!-- Version Upgrade Logic -->
    <Upgrade Id="$(var.UpgradeCode)">
      <!-- Check for an older installed version and allow it to be automatically uninstalled and the new version installed in its place. -->
      <UpgradeVersion Minimum="1.0.0" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no" OnlyDetect="no" Property="PREVFOUND" />
    </Upgrade>
    <InstallExecuteSequence>
      <RemoveExistingProducts After="InstallInitialize"/>
    </InstallExecuteSequence>
    <!-- End Version Upgrade Logic -->
    
    <Feature Id="ProductFeature" Title="$(var.ProductName)" Level="1">
      <ComponentRef Id="CompanyDecisioning" />
    </Feature>   
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder" Name="PFiles">
        <Directory Id="INSTALLDIR" Name="Company Decisioning Service">   
        </Directory>
      </Directory>
    </Directory>    
  </Fragment>
  
  <Fragment>
    <Component Id="CompanyDecisioning" Guid="{0577f44c-782d-457e-9738-152ba678f9bc}" Directory="INSTALLDIR">
      <File Id="Company.Decisioning.WinService.exe" Name="Company.Decisioning.WinService.exe" Source="..\Company.Decisioning.WinService\bin\$(var.Configuration)\Company.Decisioning.WinService.exe" Vital="yes" KeyPath="yes" DiskId='1'/>
      <File Id="App.config" Name="Company.Decisioning.WinService.exe.config" Source="..\Company.Decisioning.WinService\bin\$(var.Configuration)\Company.Decisioning.WinService.exe.config" Vital="yes" KeyPath="no" DiskId="1"/>
      <File Id="Company.Data.dll" Name="Company.Data.dll" Source="..\Company.Decisioning.WinService\bin\$(var.Configuration)\Company.Data.dll" Vital="yes" KeyPath="no" DiskId="1"/>
      <File Id="Company.Core.dll" Name="Company.Core.dll" Source="..\Company.Decisioning.WinService\bin\$(var.Configuration)\Company.Core.dll" Vital="yes" KeyPath="no" DiskId="1"/>
      <File Id="Company.Service.dll" Name="Company.Service.dll" Source="..\Company.Decisioning.WinService\bin\$(var.Configuration)\Company.Service.dll" Vital="yes" KeyPath="no" DiskId="1"/>

      <File Id="EntityFramework.dll" Name="EntityFramework.dll" Source="..\Company.Decisioning.WinService\bin\$(var.Configuration)\EntityFramework.dll" Vital="yes" KeyPath="no" DiskId="1"/>
      <File Id="EntityFramework.SqlServer.dll" Name="EntityFramework.SqlServer.dll" Source="..\Company.Decisioning.WinService\bin\$(var.Configuration)\EntityFramework.SqlServer.dll" Vital="yes" KeyPath="no" DiskId="1"/>
      <File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="..\Company.Decisioning.WinService\bin\$(var.Configuration)\Newtonsoft.Json.dll" Vital="yes" KeyPath="no" DiskId="1"/>
      <File Id="Microsoft.AspNet.Identity.Core.dll" Name="Microsoft.AspNet.Identity.Core.dll" Source="..\Company.Decisioning.WinService\bin\$(var.Configuration)\Microsoft.AspNet.Identity.Core.dll" Vital="yes" KeyPath="no" DiskId="1"/>

      <ServiceInstall Id="ServiceInstaller" Name="DecisioningService" Type="ownProcess" Vital="yes" DisplayName="Company Decisioning Service" Description="This service sends application decisions." Start="auto" Account="NT AUTHORITY\LocalService" ErrorControl="ignore" Interactive="no" Arguments=" /start DecisioningService"/>
      <ServiceControl Id="StartService" Name="DecisioningService" Start="install" Stop="both" Remove="uninstall" Wait="yes" />
    </Component>
  </Fragment>    
  
</Wix>