How to use two different package versions in one solutions with project dependencies

172 views Asked by At

I've created a solution with three projects inside. One of the projects is named Controller and uses Appium.WebDriver, which requires Selenium version 3.141. The second project is named Runner and uses Selenium version 4.11 while also having a dependency on Controller. The third project contains some tests and has a dependency on Runner.

The problem is that when I execute the tests, the project fails because the methods from Controller are executed with Selenium 4.11, but they should be executed with a version of Selenium compatible with Appium (3.141). Some features from 4.11 are also required so I can't use 3.141 in Runner.

I've tried to use PrivateAssets and ExcludingAssets, but I don't have any experience with this topic, so my attempts were unsuccessful.

Does anyone know how I can achieve this? solutionstructure

1

There are 1 answers

1
JonasH On

An application can only have a single version of a library loaded. This is a fundamental limitation of .net.

So your options are:

  1. Downgrade the runner to use Selenium 3.141. This might require rewriting the code if you are using any features exclusive to 4.11.
  2. Update Appium.Webdriver to a later version that uses a 4.x version of selenium. This might also require code changes or updates to other libraries.
  3. Load Selenium 4.11 with the current version of appium.Webdriver and hope for the best. It sound like you are doing this now, and that it does not work, so you might need to do one of the other options.
  4. Turn your controller into a separate process and use some form of IPC to communicate. This lets the controller and runner use different versions of libraries. But it is a fairly cumbersome and drastic change best left as a last resort.

The issues with library versioning are well known, and I think John Skeet summarizes the issues fairly well. He also proposes some possible solutions. But as far as I know the problem has not been addressed by the development team one way or another.