Sameer
Sameer

Reputation: 3183

How to reference project reference in HeatProject Task?

I have this markup. What should be the value of attribute Project="@(_Project)" HeatProject task? Wix doc says Required item group parameter but how do i associate the below itemgroup??

  <ItemGroup>
    <ProjectReference Include="..\MyProjectA\Presentsoft.MyProjectA.csproj">
      <Name>MyProjectA</Name>
      <Project>{59FB083D-C11C-4690-A128-28F5269125D4}</Project>
      <Private>True</Private>
    </ProjectReference>
  </ItemGroup>

  <Target Name="BeforeBuild">
    <HeatProject
   NoLogo="$(HarvestProjectsNoLogo)"
   SuppressAllWarnings="$(HarvestProjectsSuppressAllWarnings)"
   SuppressSpecificWarnings="$(HarvestProjectsSuppressSpecificWarnings)"
   ToolPath="$(WixToolPath)"
   TreatWarningsAsErrors="$(HarvestProjectsTreatWarningsAsErrors)"
   TreatSpecificWarningsAsErrors="$(HarvestProjectsTreatSpecificWarningsAsErrors)"
   VerboseOutput="$(HarvestProjectsVerboseOutput)"
   AutogenerateGuids="$(HarvestProjectsAutogenerateGuids)"
   GenerateGuidsNow="$(HarvestProjectsGenerateGuidsNow)"
   OutputFile="$(IntermediateOutputPath)_%(_Project.Filename).wxs"
   SuppressFragments="$(HarvestProjectsSuppressFragments)"
   SuppressUniqueIds="$(HarvestProjectsSuppressUniqueIds)"
   Transforms="%(_Project.Transforms)"
   Project="@(_Project)"
   ProjectOutputGroups="Content;Binaries;Satellites" />
  </Target>

I am very new to installer and wix.

Upvotes: 1

Views: 1548

Answers (1)

Tom Blodget
Tom Blodget

Reputation: 20812

Your question is about MSBuild. The task refers to the _Project item group but you have a ProjectReference item group. To fix it, just replace _Project with ProjectReference everywhere.

However, due to the design of WiX's targets, you don't need to invoke the HeatProject task directly. They do it as part of the main build if you enable it both generally and for each specific project reference.

<PropertyGroup>
  <EnableProjectHarvesting>True</EnableProjectHarvesting>
</PropertyGroup>


<ItemGroup>
  <ProjectReference Include="..\MyProjectA\Presentsoft.MyProjectA.csproj">
    <Name>MyProjectA</Name>
    <Project>{59FB083D-C11C-4690-A128-28F5269125D4}</Project>
    <Private>True</Private>
    <DoNotHarvest>
    </DoNotHarvest>
    <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
    <RefTargetDir>INSTALLFOLDER</RefTargetDir>
  </ProjectReference>   
</ItemGroup>

The output is generated in the "obj" folder, if you really want to see it. But, all you need to do is add something like the following where needed (e.g., inside a Feature).

  <ComponentGroupRef Id="MyProjectA.Binaries" />

Upvotes: 3

Related Questions