How can we support multiple versions of Sage50

We are a POS system using the COM component to integrate to Sage50.  We have some stores that use Sage50 2020 (which is the version of our COM component) and this works fine.  We have some that just installed the Sage50 2021 version, and our integration does not work because of COM errors.  In our test environment, updating the COM assembly in our code to the 2021 version allows us to work with the newer stores, but our stores running 2020 no longer works.  How can we support different stores running different yearly versions of your software?

  • We ended up solving this using a configuration switch, and multiple versions of the dll. We've renamed different versions of the dll with their respective years: Interop.PeachwServer.dll to "Interop.PeachwServer.2020.dll", "Interop.PeachwServer.2021.dll", and "Interop.PeachwServer.2022.dll".  When the program loads up, we check the config switch, and rename the appropriate one to "Interop.PeachwServer.dll".