[wix-users] Incorrect Version of Autofac Bound in Custom Bootstrapper UI

Mark Olbert Mark at arcabama.com
Mon May 15 13:21:24 PDT 2017


I’m building a WPF-based custom UI for bootstrapper. Everything compiles fine, and I can launch the resulting exe installer in debug mode via an embedded call to System.Diagnostics.Debugger.Launch().

However, I’m getting an odd (to me 😊) error involving an attempt to bind an incorrect version of Autofac, which I am using as an IOC/DI subsystem.

The exception is:

System.IO.FileLoadException occurred HResult=0x80131040
Message=Could not load file or assembly 'Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source=Olbert.Wix.MinimalUI StackTrace: at Olbert.Wix.ViewModels.WixLocator.<>c__DisplayClass0_0.<.cctor>b__5()
in C:\Programming\LanHistory\WixUI\viewmodels\WixLocator.cs:line 99

at Microsoft.Practices.ServiceLocation.ServiceLocator.get_Current()
at Olbert.Wix.ViewModels.WixLocator.get_WixViewModel()
in C:\Programming\LanHistory\WixUI\viewmodels\WixLocator.cs:line 103
at Olbert.Wix.WixApp.Run() in C:\Programming\LanHistory\WixUI\WixApp.cs:line 28
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

What’s weird about this is that none of the projects involved use v3.5 of Autofac; I’ve installed only v4.5, via nuget.

I tried including the .dll.config file as a Payload element, thinking that the app.config file it’s based on – which looks like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup></configuration>

Might be important…but including it doesn’t solve the problem.

Here’s what my bundle.wxs looks like:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
       <Bundle Name="LanHistoryBootstrapper"
          Version="0.5.0.0"
          Manufacturer="Jump for Joy Software"
          UpgradeCode="1db721ec-d675-4e60-a55b-d134497a5a35">
    <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)Olbert.LanHistorySetupUI.dll"/>
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)Olbert.LanHistorySetupUI.dll.config"/>

      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Autofac.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Autofac.Extras.CommonServiceLocator.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\BootstrapperCore.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\GalaSoft.MvvmLight.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\GalaSoft.MvvmLight.Extras.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\GalaSoft.MvvmLight.Extras.pdb" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\GalaSoft.MvvmLight.pdb" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\GalaSoft.MvvmLight.Platform.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\GalaSoft.MvvmLight.Platform.pdb" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Microsoft.Practices.ServiceLocation.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Microsoft.Practices.ServiceLocation.pdb" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Olbert.j4j.UI.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Olbert.j4j.UI.pdb" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Olbert.Wix.MinimalUI.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Olbert.Wix.MinimalUI.dll.config" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Olbert.Wix.MinimalUI.pdb" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Serilog.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Serilog.Sinks.File.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\Serilog.Sinks.RollingFile.dll" />
      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)\System.Windows.Interactivity.dll" />

      <Payload SourceFile="$(var.LanHistorySetupUI.TargetDir)BootstrapperCore.config"/>
    </BootstrapperApplicationRef>

              <Chain>
                     <!-- TODO: Define the list of chained packages. -->
                     <!-- <MsiPackage SourceFile="path\to\your.msi" /> -->

      <PackageGroupRef Id="NetFx462Web"/>
      <MsiPackage SourceFile="$(var.LanHistorySetup.TargetDir)LanHistorySetup.msi" />
              </Chain>
       </Bundle>
</Wix>

Any advice would be greatly appreciated.


  *   Mark


More information about the wix-users mailing list