After doing an update of all NuGet packages, one of my applications began crashing on start-up with a FileLoadException
:
Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
This was after upgrading ServiceLocation
to version 1.3.0.0, and I double-checked all assemblies to ensure that they were using that version. I then ran Fuslogvw
to diagnose the assembly that was still referencing the old version:
LOG: DisplayName = Microsoft.Practices.ServiceLocation, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Users/Charlie/AppData/Local/Programs/MyClient/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyClient.exe
Calling assembly : Microsoft.Practices.Prism.UnityExtensions, Version=5.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
So, UnityExtensions
(another NuGet package) is still referencing the old version. But that should be OK, because I've added a bindingRedirect
to my app.config file:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding>
But this seems to make no difference. My application is targeting .NET Framework 4.5.1, and I've tried it with AutoGenerateBindingRedirects
on and off. In other words, I've tried literally everything. What is going on here?
All you need to solve this issue is to update all PRISM and Unity related packages in all projects. Editing of binding redirects in not required.
See details on codeplex
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With