Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 2.71 KB

README.md

File metadata and controls

56 lines (41 loc) · 2.71 KB

Purpose

MsBuild helper for Wix auto-harvesting (using heat.exe) during build.

See role in the build process:

WixAutoHarvest in the build process

Usage

  1. In your Wix project (.wixproj) Install a NuGet package - depending on the type of a project being packaged to MSI use:
  1. In your Wix project Add a reference to the project to be packaged to MSI

  2. In Product.wxs add ComponentGroup include_cg to a Feature, see example:

<Feature ...>
	...
	<ComponentGroupRef Id="include_cg" />
</Feature>
  1. [optonal] if you require any alterations to harvested file generated by heat.exe - create .xslt file and pass it in TransformFile property in your .wixproj

  2. [optonal] if Platform of the target packaged project is not "Any CPU", add ReferencedProjectPlatform property to .wixproj with correct value, see example for "x86" platform:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ReferencedProjectPlatform>x86</ReferencedProjectPlatform>
    ...

Development

Preparation

  1. Clone this repo
  2. Get NuGet API key from your account on nuget.org
  3. Store API key locally: nuget setApiKey %API_KEY% -Source https://www.nuget.org/api/v2/package

Dev cycle

  1. Make changes
  2. Package locally by: nuget pack
  3. Install locally to a Wix project (add local folder with .nupkg as NuGet feed) and test that it builds
  4. Once happy, package and publish by running: nuget-pack-and-push.bat

TODO

  • Automate adding of a <Feature> with <ComponentGroupRef Id="include_cg" /> to Product.wxs during NuGet package installation.
  • [BUG] Example ConsoleApplication1 won't build on a clean clone - fails with error "Unresolved reference to symbol 'WixComponentGroup:include_cg' in section 'Product:*'". However closing and reloading the whole solution helps.
  • Consider using <RefTargetDir> from .wixproj instead of hard-coded INSTALLFOLDER. This potentially will allow to reference multiple projects to install them to separate directories. See also Rob's explanation about original harvesting feature and its use of RefTargetDir here: http://stackoverflow.com/a/15578516/902415
  • Add example of XSLT for registering Windows Service, with automatic fetching of .exe file name from the AssemblyName of %(ProjectReference.Identity) as it's done in PublishReferencedProject target.