1

My application references the Sage50 SDK and I need to support multiple versions of the SDK.

In Visual Studio each version of the SDK has its own project and has the SDK DLL's referenced.

But when I build the solution the DLL's overwrite eachother and only 1 version remains.

I can't rename the DLL's because the SDK loads other DLL's by name and will error out when they are renamed. And they are signed.

How would I go about a situation like this?

Roger Far
  • 2,178
  • 3
  • 36
  • 67
  • 1
    Are the Sage50 DLLs strongly named? (i.e., do references to them include version & culture information and a PublicKeyToken?) – Flydog57 Jan 14 '19 at 23:37
  • @Flydog57 yes they are. They are even signed. – Roger Far Jan 14 '19 at 23:39
  • And there is no "backwards compatibility" guarantee? If there is one, a binding redirect can assure that you get the latest version. Have you talked to the Sage50 publisher? – Flydog57 Jan 14 '19 at 23:55
  • Unfortunately there isn't. When I open an older version with a newer SDK I get the error: 'The company file cannot be opened because it's version (25.20.0.2) is not compatible with the application (26.10.0.1).' – Roger Far Jan 15 '19 at 14:12

1 Answers1

1
  1. Make each project uses a 'strong' reference to those different sage SDK assemblies. That is, make sure it specifies a version, culture, and token etc... Nothing worse than a versionless, sloppy reference.
  2. You will have to output your project DLL's to separate locations. Because the build will copy all dependencies to the output folder.
  3. Because of #2, you will have to dynamically load your assemblies in your application. (i.e. Assembly.load(...))
C.J.
  • 15,637
  • 9
  • 61
  • 77
  • Can you elloborate a bit on the 3rd step? How do I make sure that the assembly loads to the correct project? – Roger Far Jan 16 '19 at 19:07
  • #3 at runtime, you will have to iterate over all the directories where you had your assemblies put. For each directory you will have to load your assembly that your built. – C.J. Jan 16 '19 at 20:27