WiX HEAT5151: Could not harvest data from a file that was expected to be an assembly

382 Views Asked by At

Im working on a WiX installer for an Avaloina UI application. When using heat.exe to generate my components, I get errors for every DLL in my publish folder which say:

1>heat.exe(0,0): warning HEAT5151: Could not harvest data from a file that was expected to be an assembly: bin\Release\net6.0\win-x86\publish\Avalonia.dll. If this file is not an assembly you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: Could not load type 'System.Object' from assembly 'System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because the parent does not exist.

I have tried on both x86 and x64 with both self-contained and non-self-contained builds but I still always get errors. Interestingly, I get a different error when using not using self-contained vs self contained.

Self-contained:

1>heat.exe(0,0): warning HEAT5151: Could not harvest data from a file that was expected to be an assembly: bin\Release\net6.0\win-x86\publish\Avalonia.Base.dll. If this file is not an assembly you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: Could not load type 'System.Object' from assembly 'System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because the parent does not exist.

Non self-contained:

1>heat.exe(0,0): warning HEAT5151: Could not harvest data from a file that was expected to be an assembly: bin\Release\net6.0\win-x86\publish\Avalonia.Base.dll. If this file is not an assembly you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I have verified that heat is pointing at the correct directory and Im not sure what else to try.

Before Build:

<!-- Before build -->
<Target Name="BeforeBuild">
    <!-- Clean previous build folder -->
    <Exec Command="rd /s /q ..\Project\bin\$(Configuration)\net6.0\win-$(Platform)" />
    <!-- Publish dotnet core app -->
    <Exec Command="dotnet publish ..\Project\Project.csproj -c $(Configuration) -r win-$(Platform) --self-contained"/>
    
    <!-- Get assembly version -->
    <GetAssemblyIdentity AssemblyFiles="..\Project\bin\$(Configuration)\net6.0\win-$(Platform)\Project.dll">
        <Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
    </GetAssemblyIdentity>

    <!-- Define some variables we need -->
    <PropertyGroup>
        <DefineConstants>BuildVersion=%(AssemblyVersion.Version);BasePath=..\Project\bin\$(Configuration)\net6.0\win-$(Platform)\publish</DefineConstants>
    </PropertyGroup>
    
    <!-- Harvest file components from publish folder -->
    <HeatDirectory 
        OutputFile="ComponentsGenerated.wxs" 
        DirectoryRefId="INSTALLFOLDER" 
        ComponentGroupName="PublishedComponents" 
        SuppressCom="true"
        Directory="..\Project\bin\$(Configuration)\net6.0\win-$(Platform)\publish"
        SuppressRootDirectory="true" 
        AutoGenerateGuids="false" 
        GenerateGuidsNow="true"
        ToolPath="$(WixToolPath)"
        PreprocessorVariable="var.BasePath" 
        RunAsSeparateProcess="$(RunWixToolsOutOfProc)" />

</Target>

Error log:

1>heat.exe(0,0): warning HEAT5151: Could not harvest data from a file that was expected to be an assembly: {dir}\bin\Release\net6.0\win-x86\publish\Amazon.Extensions.Configuration.SystemsManager.dll. If this file is not an assembly you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: Could not load type 'System.Object' from assembly 'System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because the paren
1>heat.exe(0,0): warning HEAT5151: Could not harvest data from a file that was expected to be an assembly: {dir}\bin\Release\net6.0\win-x86\publish\Avalonia.Base.dll. If this file is not an assembly you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: Could not load type 'System.Object' from assembly 'System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because the parent does not exist.
1>heat.exe(0,0): warning HEAT5151: Could not harvest data from a file that was expected to be an assembly: {dir}\bin\Release\net6.0\win-x86\publish\Avalonia.Controls.DataGrid.dll. If this file is not an assembly you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: Could not load type 'System.Object' from assembly 'System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because the parent does not exist.
.... etc

Thanks, Adam

0

There are 0 best solutions below