1

I have a Caliburn.Micro application with many projects. Several projects refer to the same dll in a separate folder. Now I needed to replace that dll with a newer version. I removed the reference from all projects and added it again. But I am getting a runtime error:

enter image description here

Could you please help?

P.S. I tried to use fuslogvw.exe, but it shows up empty: enter image description here

Jay Walker
  • 4,654
  • 5
  • 47
  • 53
David Shochet
  • 5,035
  • 11
  • 57
  • 105
  • what is the error & it is better to use nuget for third party dlls. – daryal Jan 23 '13 at 15:49
  • The error can be seen on the picture in my question: Could not load file or assembly 'FileHelpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e0c08d59cc3d657' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) – David Shochet Jan 23 '13 at 15:56
  • have you tried cleaning and rebuilding your solution? – Thomas Lindvall Jan 23 '13 at 16:09
  • Yes, but it didn't help. – David Shochet Jan 23 '13 at 16:20
  • Well, the update didn't go well. It is finding the wrong version of the FileHelpers.dll assembly, probably the old version. If you have no idea where it comes from then use Fuslogvw.exe to get insight. – Hans Passant Jan 23 '13 at 16:29
  • Could you please give me more information about it? Where is it? – David Shochet Jan 23 '13 at 16:30
  • I found it, and ran, but it is all empty, so I don't know how to pick the application. I added a picture to the original question. – David Shochet Jan 23 '13 at 16:43

2 Answers2

2

I think you're using Visual Studio. First of all, check in the properties of all that FileHelpers referenced if the Specific Version is set to False (if not, do it). Try to clean and build back.

If the problem persist, in the app.config of your solution, in the configuration section, add

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="FileHelper" publicKeyToken="3e0c08d59cc3d657" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

In this way you should be able to force the used version to the new one.

Mattia Vitturi
  • 235
  • 4
  • 17
  • Specific Version was set to False. I added that assembly binding, but nothing helped :( – David Shochet Jan 23 '13 at 17:19
  • I copied your code for app.config and didn't notice that it had FileHelper instead of FileHelpers. When I changed it, it worked. Thanks. – David Shochet Jan 23 '13 at 20:09
  • Oops, sorry for the error, I'm glad it helped. Probably some referenced dlls referes to the older version of FileHelpers. You should check from time to time if you can take off those lines from the app.config. – Mattia Vitturi Jan 24 '13 at 10:46
  • This morning I opened the Log Viewer, and it was filled with assemblies. I don't know what changed since yesterday. I even found one reference to an old dll. After I fixed it, I was able to remove the mapping from app.config and run the application, but was not able to open it after publishing by clickonce. So I had to restore the mapping, don't know why. – David Shochet Jan 24 '13 at 20:52
0

My guess is that you need to add references to other assemblies.

Please attach the text of the csproj to show the reference to the dll you updated.

Assemblies can reference other assemblies that aren't required to compile but are required at runtime. You need to determine if FileHelpers is the assembly you explicitly referenced. Please see the following links on how to use Fusion Log Viewer. It will give you information on where it is looking to find assemblies.

Community
  • 1
  • 1
Jay Walker
  • 4,654
  • 5
  • 47
  • 53
  • I have many projects in the solution. Here is part of the main project: False ..\..\lib\FileHelpers.dll – David Shochet Jan 23 '13 at 17:29
  • And the Log Viewer's list of aplications is empty (I don't know why), as you can see on a picture I attached in the original question. – David Shochet Jan 23 '13 at 17:30
  • 1
    @David, You don't have Fusion Log Viewer configured correctly. that's why you don't see any assemblies. I included the links to help you troubleshoot why you don't see any entries. Sorry I wasn't clear on that. Glad the assembly binding got you working. – Jay Walker Jan 23 '13 at 22:45
  • This morning I opened the Log Viewer, and it was filled with assemblies. I don't know what changed since yesterday. I even found one reference to an old dll. Thanks. – David Shochet Jan 24 '13 at 20:51
  • If you search the log for `FileHelpers` you will find the assembly that is referencing the old version. It could be somewhere in your projects where you still hold a ref to the older version, or it could be via a compiled reference that holds a reference to the old version. If it is the later - then @VollmonD solution maybe the only way to solve, otherwise, if it is code you control, it might be best to just update your ref directly and then remove the runtime assemblybinding. – Jay Walker Jan 24 '13 at 22:23