Craig Bovis
Craig Bovis

Reputation: 2811

Confused about version numbers of references within my .NET application

I have a .NET project which references a DLL called ABCPDF. The version number used when the application was written is 7.0.2.3 and the application was deployed onto a staging server.

The version of the software on the staging server is 7.0.2.8 and the application is breaking saying that it cannot find version 7.0.2.3

Surely it should use the 7.0.2.8 version of the DLL rather than require me to recompile using 7.0.2.8 on my development machine? If I were to update the version of ABCPDF on live servers 6 months later it would break every application using a previous version without me knowing.

Am I getting the wrong end of the stick here?

Upvotes: 4

Views: 401

Answers (2)

Brett Allen
Brett Allen

Reputation: 5487

Right click on the reference and click Properties.

In the properties for the reference, set "Specific Version" to false.

While this could cause issues if ABCPDF broke backwards compatibility, if they didn't this will solve your problem.

Edit: Does not apply if you're using signed assemblies, see other answer. Was unaware ABCPDF was signed.

Upvotes: 0

Igor Korkhov
Igor Korkhov

Reputation: 8558

You may consider using assembly binding redirection, see the below code:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Your.Assembly" publicKeyToken="your token here"/>
            <bindingRedirect oldVersion="7.0.2.3" newVersion="7.0.2.8"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Just put that code fragment in your App.Config file

Upvotes: 3

Related Questions