-->

Replacing dll to a newer version

2019-03-02 23:01发布

问题:

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:

Could you please help?

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

回答1:

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.



回答2:

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.

  • MSDN docs
  • SO troubleshooting
  • An old Hanselman post on fuslogvw