mercredi 6 mai 2015

MS Fake assembly pickes old Newtonsoft assembly version on build server

This is my first unit test project using MS Fakes framework. In my test project (U), I am referencing another project (A) which is being tested. A is referring newton soft assembly version 6.0.0.0. U doesn't have any reference to newton soft. I generate fake assembly for A in U and then, I can build whole solution successfully and test properly. After that when I check in, main problem starts. CI build kicks off after check-in and build fails due to this check in. Reason is conflicting versions of newton soft and I get this error message d:\Bld1\8333\Binaries\A.dll: Assembly 'A, Version=4.15.0.0, Culture=neutral, PublicKeyToken=null' uses 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' which has a higher version than referenced assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' [....UnitTest\obj\Release\Fakes\gcmn\f.csproj]

Problem is CI build environment is not in my control. So I made below 2 changes

  1. Used config file binding redirect for newton soft
  2. Added reference of newton soft in U (unit test project) and then generated fakes assembly.

But option 1 alone or 1 & 2 together, both are not working. I also tried to set specific version property true/ false of newton soft reference in U. But that is also not working. So I have run out of options. Please let me know if you think any other option is left apart from CI build upgrade option (this server is used by many project so I am not sure if this is really an option or not). I will like to try any other approach if possible.

Aucun commentaire:

Enregistrer un commentaire