4

We have a vendor who is writing an application for us who makes use of a dll I've provided to them. My boss just found out that if we ever need to make a change to one of our dll's we'd have to provide the updated version to the vendor so they could recompile their project. This causes problems because we don't have automated testing and any new build would require a complete run-through by our QA department.

I've not done too much with the GAC before but believe it could be what we're looking for. Is there a way I could deploy my dll (the one I provide to the vendor) to the GAC and have the vendor build their .net project in such a way as to always grab the latest version from the GAC?

starblue
  • 55,348
  • 14
  • 97
  • 151
Lee Warner
  • 2,543
  • 4
  • 30
  • 45

2 Answers2

4

They will need to set the SpecificVersion property of the reference to false in the project that they're compiling. See this question and the article that it links to.

Community
  • 1
  • 1
Adam Robinson
  • 182,639
  • 35
  • 285
  • 343
1

If you have made a breaking change in your DLL, you will of course need to ship the new version so your vendor can compile with it.

But otherwise there is no need for the vendor to have the latest version. Instead you can use Assembly Binding Redirection to ensure you are using the most appropriate (usually latest) version at runtime.

There are several ways to achieve this as described in the linked article - the most common is to use settings in the application configuration file (if you only want to affect this application) or a publisher policy file (if you want to affect all applications that use the shared assembly).

Joe
  • 122,218
  • 32
  • 205
  • 338
  • By default, any strong-signed assembly (which you have to do to put it into the GAC) is bound to a specific version, breaking this suggestion. The vendor will have to set the `SpecificVersion` option to `false`, as I suggested in my answer. – Adam Robinson Jan 06 '10 at 21:04
  • "...breaking this suggestion" - no, the SpecificVersion option affects Visual Studio. At runtime, assembly binding can be overridden despite the fact a specific version was specified when building. – Joe Jan 06 '10 at 21:08
  • @Joe can you elaborate on that a little? If I have project A which references 3rd party library X, can I build A in a way that it would use the latest available version of X at runtime without me having to write the binding redirection configs every time? – Mr. TA May 25 '12 at 18:01
  • @Mr. TA, If you reference a 3rd party assembly with a binary refereence, and use Copy Local to copy it to your project's output directory, you'll always automatically have the latest version. – Joe May 25 '12 at 18:11
  • 1
    @Joe Yes, if I re-build my project. What if I can't (or it's difficult/time consuming to) re-build my project? – Mr. TA May 25 '12 at 18:23
  • this solution solves a very difficult scenario: you need to refer a dll A which requires a specific version of another dll B. But you also need to refer a newer version of the dll B from your code. I am curious what would happen if you had to refer two dlls dependent on a same library but each requesting a different specific version – Radu Simionescu Apr 03 '13 at 19:02