Wix Heat Error on Jenkins CI

2019-08-07 06:39发布

问题:

I am building a wix bundle that depends on a wix setup project and the wix setup depends on a C# project. When I build locally, everything works great but when I build the bundle on Jenkins, I get an error when I try to harvest some files. The heat operation is a pre-build event.

heat.exe : error HEAT5053: The directory 'c:\.Hudson\jobs\Project-Branch\workspace\MyProject\bin\x86\Release\Help' did not contain any files or sub-directories and since empty directories are not being kept, there was nothing to harvest

I checked MyProject workspace in `bin\x86\Release' and the files are not there so it makes sense that I'd get this error. But if I don't build my installer project and my bundle (bootstrap) project, my files are there. Somehow they are getting removed with my wix projects building. Any ideas?

回答1:

The heat command cannot be a pre build event. I kind of had a feeling that Jenkins is not waiting for my C# project to be built but I don't 100% know what it's doing exactly. I changed heat to run at AfterResolveReferences which is still a pre build event and that way it makes sure that any references are build before it tries anything. Kind of a niche case but hopefully it helps anyone else that comes across this issue



回答2:

I'm not sure if it's related but I had a similar issue (heat.exe : error HEAT5053) with a TFS build.
I had to build my Winforms project as x86. Changing the project platform from Any CPU to x86 in the Solution Configuration Manager, leaving the solution platform to Any CPU, changed my Build output path in the project properties.

.csproj after changing the project plaform to x86:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
    <OutputPath>bin\x86\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <Optimize>true</Optimize>
    <DebugType>pdbonly</DebugType>
    <PlatformTarget>x86</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

Changing it to the code below fixed my problem.

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <Optimize>true</Optimize>
    <DebugType>pdbonly</DebugType>
    <PlatformTarget>x86</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

You can of course also change it via Properties -> Build -> Output -> Output path.