1
votes

I built a simple WIX installer that deploys an exe and a third-party dll, and creates shortcuts. The installer appears to work fine, and places both the exe and dll in a folder in C:\Program Files(x86), but when I try to run the application I get an error:

System.IO.FileLoadException: Could not load file or assembly 'GACManagerApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'GACManagerApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

The application runs just fine from the IDE, and even from the executable in the IDE bin directory, but after deploying with WIX cannot load the assembly. On a hunch, I copied the dll from the bin directory to the deployed location, and it started working. Looking closer, it appears that WIX is doing something to the third-party metadata when it deploys that changes the signature enough that the exe can no longer load it. Here is the definition of the assembly in the wxs:

<Component Id="GACManagerApi">
<File Id="GACManagerApiDLL" Name="GACManagerApi.dll" Source="$(var.GHCComponentManager.TargetPath)" />
</Component>

I also noticed that the details on the dll properties are different, with the File description, product name and original filename being changed to that of my executable, instead of the original values for the assembly.

Am I missing something in my wsx that is causing this to happen?

1
Are you sure you are pulling the right version of the ghc component manager during wix compilation? From the right location etc? I haven't seen wix manipulating meta data or anything of that sort.Isaiah4110
It's not the component manager itself that is the problem, but yes, it should always be pulling the build version and there is only one version. The assembly it is using, pulled with var.GHCComponentManager.TargetPath, should be the referenced version as I'm using Copy Local which will put it in the bin directory with the exe. It is that bin version that I can copy and paste to the install version, and everything works.Josh Schmidt
Can you update the question with your wix script?Isaiah4110
I figured it out and posted the answer. Thanks for taking the time to look and respond. I was set to give up actually and pursue other options, but responding to your first comment got my wheels turning again.Josh Schmidt

1 Answers

1
votes

I figured it out. The problem was how I was defining the Source attribute. The hint really should have been in the file property details, but I was too consumed with my assumptions to see it. I was reading some other documents talking about pulling assemblies from outside the project when I noticed it.

I was defining the source as:

Source="$(var.GHCComponentManager.TargetPath)"

which translates literally to the full path of my release executable. With the Name attribute of the File element, it was effectively moving my executable to the release location and renaming it GACManagerApi.dll. The correct source should be:

Source="$(var.GHCComponentManager.TargetDir)\GACManagerApi.dll"