Error using Octopack to package WiX bootstrap Setup.exe

When I add Octopack to my WiX bootstrap project I get the following error message during build:

OctoPack.targets (41): The “GetAssemblyVersionInfo” task failed unexpectedly.
System.BadImageFormatException: Could not load file or assembly ‘Setup.exe’ or one of its dependencies. The module was expected to contain an assembly manifest.
File name: ‘Setup.exe’ —> System.BadImageFormatException: Could not load file or assembly ‘Setup.exe’ or one of its dependencies. The module was expected to contain an assembly manifest.

The error seems to stem from OctoPack.Tasks.GetAssemblyVersionInfo.CreateTaskItemFromFileVersionInfo which is calling:

var currentAssemblyName = AssemblyName.GetAssemblyName(info.FileName);

The AssemblyName.GetAssemblyName(string) method, as I understand it, only works for .NET assemblies and throws the previously mentioned error when called on my bootstrap Setup.exe.

Any help would be very much appreciated.

Hi Ryan,

Thanks for getting in touch! OctoPack is really only designed to be run on C# or VB projects. To package your WiX installers, it’s best to create a custom NuSpec file, and then to run NuGet.exe pack over it. We have a little info here:

Hope that helps!

Paul