I am completely new to wix, so bare with me here. I have followed a guide
here
http://nicholasarmstrong.com/2014/08/sideloading-windows-8-apps-with-wix/
to create an installer that sideloads a windows 8.1 application. I have
that working after messing with it for a while. I also want my wix
installer to install a service. My service has a number of dependency DLLs
such as log4net, sqlite, etc. I tried following this guide
http://www.talksharp.com/wix-toolset-install-windows-service to integrate
what I saw there into my existing installer that does the sideloading. At
first, the installer was place the service executable in the installation
directory, but there would not be any of the included DLLs necessary for it
to run. I am just lost at this point trying to take those two examples and
merge them into what I want working.

I have added the service project as a reference to my wix project.

I have also added this to my wixproj file:
<PropertyGroup>
  <!-- Service file harvesting -->
  <ServiceDir>..\PRISMContingencyService\bin\$(Configuration)\</ServiceDir>

<DefineConstants>$(DefineConstants);ServiceDir=$(ServiceDir)</DefineConstants>
  </PropertyGroup>
<ItemGroup>
    <!-- Harvest service -->
    <HarvestDirectory Include="$(ServiceDir)">
      <InProject>false</InProject>
      <DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
      <ComponentGroupName>ComponentGroup.Service</ComponentGroupName>
      <PreprocessorVariable>var.ServiceDir</PreprocessorVariable>
      <SuppressRootDirectory>true</SuppressRootDirectory>
    </HarvestDirectory>
  </ItemGroup>


In the config.wxi file I have a number of lines including:
<?define ServiceExeName = "PRISMContingencyService.exe" ?>



And I think this is the relevant part in the Setup.wxs file that I can't
figure out:
<Feature Id="ProductFeature" Title="Sideload PRISM Contingency App"
Level="1">
      <ComponentGroupRef Id="ComponentGroup.App" />
      <ComponentGroupRef Id="ComponentGroup.PowerShellScripts" />
      <ComponentGroupRef Id="ComponentGroup.Service"/>
      <!--<ComponentRef
Id="$(var.PRISMContingencyService.TargetFileName)"/>-->
    </Feature>

    <UIRef Id="WixUI_Minimal" />
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="$(var.InstallFolderName)" />
      </Directory>
    </Directory>

    <!-- New stuff here -->
    <DirectoryRef Id="INSTALLFOLDER">
      <!-- Create a single component which is the TestService.exe file -->
      <Component Id="Component.ServiceComponent">
        <!-- Copies the TestService.exe file using the project reference
preprocessor variables -->
        <File Id="File.ServiceFile"
Source="[INSTALLFOLDER]\$(var.ServiceExeName)" KeyPath="yes" />
        <!-- Remove all files from the INSTALLFOLDER on uninstall -->
        <!--<RemoveFile Id="ALLFILES" Name="*.*" On="both" />-->
        <!-- Tell WiX to install the Service -->
        <ServiceInstall Id="ServiceInstaller"
                Type="ownProcess"
                Name="PRISMContingencyService"
                DisplayName="PRISMContingencyService"
                Description="Service for the PRISM Contingency Windows
Application."
                Start="auto"
                ErrorControl="normal"
                Account="localSystem"
                Vital="yes"/>
        <!-- Tell WiX to start the Service -->
        <ServiceControl Id="StartService" Start="install" Stop="both"
Remove="uninstall" Name="PRISMContingencyService" Wait="yes" />
      </Component>
    </DirectoryRef>
  </Fragment>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" 
xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>3.9</ProductVersion>
    <ProjectGuid>7e2754b4-2a4a-494f-99cf-599bc7a444f6</ProjectGuid>
    <SchemaVersion>2.0</SchemaVersion>
    <OutputName>PRISMWixInstaller</OutputName>
    <OutputType>Package</OutputType>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND 
'$(MSBuildExtensionsPath32)' != '' 
">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' 
">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    <DefineConstants>Debug</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
  </PropertyGroup>
  <PropertyGroup>
    <!-- Configuration for app harvesting -->
    
<AppxDir>..\PRISMContingencyApp\bin\$(Configuration)\AppPackages\PRISMContingencyApp_Test\</AppxDir>
    <DefineConstants>$(DefineConstants);AppxDir=$(AppxDir)</DefineConstants>
  </PropertyGroup>
  <PropertyGroup>
  <!-- Service file harvesting -->
  <ServiceDir>..\PRISMContingencyService\bin\$(Configuration)\</ServiceDir>
  <DefineConstants>$(DefineConstants);ServiceDir=$(ServiceDir)</DefineConstants>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Setup.wxs" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="Add-AppPackage.ps1" />
    <Content Include="config.wxi" />
    <Content Include="packages.config" />
    <Content Include="Remove-AppPackage.ps1" />
  </ItemGroup>
  <ItemGroup>
    <!-- Harvest app package -->
    <HarvestDirectory Include="$(AppxDir)">
      <InProject>false</InProject>
      <DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
      <ComponentGroupName>ComponentGroup.App</ComponentGroupName>
      <PreprocessorVariable>var.AppxDir</PreprocessorVariable>
      <SuppressRootDirectory>true</SuppressRootDirectory>
    </HarvestDirectory>
  </ItemGroup>
  <ItemGroup>
    <!-- Harvest service -->
    <HarvestDirectory Include="$(ServiceDir)">
      <InProject>false</InProject>
      <DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
      <ComponentGroupName>ComponentGroup.Service</ComponentGroupName>
      <PreprocessorVariable>var.ServiceDir</PreprocessorVariable>
      <SuppressRootDirectory>true</SuppressRootDirectory>
    </HarvestDirectory>
  </ItemGroup>
  <ItemGroup>
    <WixExtension Include="WixNetFxExtension">
      <HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
      <Name>WixNetFxExtension</Name>
    </WixExtension>
    <WixExtension Include="WixUtilExtension">
      <HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
      <Name>WixUtilExtension</Name>
    </WixExtension>
    <WixExtension Include="WixUIExtension">
      <HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
      <Name>WixUIExtension</Name>
    </WixExtension>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference 
Include="..\PRISMContingencyApp\PRISMContingencyApp.csproj">
      <Name>PRISMContingencyApp</Name>
      <Project>{8434a0f9-e2aa-4686-8dec-04a8acd28ff3}</Project>
      <Private>True</Private>
      <DoNotHarvest>True</DoNotHarvest>
      
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
      <RefTargetDir>INSTALLFOLDER</RefTargetDir>
    </ProjectReference>
    <ProjectReference 
Include="..\PRISMContingencyService\PRISMContingencyService.csproj">
      <Name>PRISMContingencyService</Name>
      <Project>{5f9d6cc7-70ff-4904-b607-aad27f6c28dc}</Project>
      <Private>True</Private>
      <DoNotHarvest>
      </DoNotHarvest>
      
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
      <RefTargetDir>INSTALLFOLDER</RefTargetDir>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(WixTargetsPath)" />
  <!--
        To modify your build process, add your task inside one of the targets 
below and uncomment it.
        Other similar extension points exist, see Wix.targets.
        <Target Name="BeforeBuild">
        </Target>
        <Target Name="AfterBuild">
        </Target>
        -->
</Project>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to