Best practice to avoid assembly conflicts when custom extensions load same Third Party assemblies with different versions

Best practice to avoid assembly conflicts when custom extensions load same Third Party assemblies with different versions

book

Article ID: KB0082481

calendar_today

Updated On:

Products Versions
Spotfire Developer All versions

Description

There are instances when we may have multiple custom extensions which reference Third Party dll ( e.g. Newtonsoft.Json). So if the version of these 3rd party dlls is different in different extensions, we may come across assembly conflict specific issues.
This could be a common issue when developing Spotfire extensions

Example error details:
 "Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)".

 

Issue/Introduction

Best-practice-to-avoid-assembly-conflicts-when-custom-extensions-load-same-Third-Party-assemblies-with-different-versions

Resolution

If an extension requires a certain version of a dll, or uses a dll not "always" available on the machine running the extension, then the dll should be included in the spk. 
The included dlls need to have a Strong Name otherwise the system will not regard them as different versions. 
So if everything is configured correctly it should work.

If a dll does not have a Strong Name then you must ensure there is only one of that dll and that anything compiled towards that dll can reach that dll.