Replacing dll to a newer version
Asked Answered
C

2

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

How can I resolve this?

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

enter image description here

Copenhaver answered 23/1, 2013 at 15:46 Comment(7)
what is the error & it is better to use nuget for third party dlls.Fuzzy
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)Copenhaver
have you tried cleaning and rebuilding your solution?Fyn
Yes, but it didn't help.Copenhaver
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.Deanadeanda
Could you please give me more information about it? Where is it?Copenhaver
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.Copenhaver
M
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.

Metre answered 23/1, 2013 at 16:55 Comment(4)
Specific Version was set to False. I added that assembly binding, but nothing helped :(Copenhaver
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.Copenhaver
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.Metre
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.Copenhaver
D
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.

Discommend answered 23/1, 2013 at 17:11 Comment(5)
I have many projects in the solution. Here is part of the main project: <Reference Include="FileHelpers, Version=2.9.15.0, Culture=neutral, PublicKeyToken=3e0c08d59cc3d657, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\lib\FileHelpers.dll</HintPath>Copenhaver
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.Copenhaver
@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.Discommend
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.Copenhaver
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.Discommend

© 2022 - 2024 — McMap. All rights reserved.