Third party nuget package conflict
brunce10 opened this issue · comments
The scenario is roughly like this:
there are two extensions that reference the same nuget package, but have different versions. As a result, both extensions are installed in VS, and one of them cannot run properly. The reason is that the version of the referenced nuget package is too low. How can we solve this scenario? Thank you.
Here are some key error messages:
System.IO.FileLoadException: Could not load file or assembly XXXX, Version=x.x.x.x, Culture=neutral, PublicKeyToken=... or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I think you can use ProvideCodeBase attribute
Thank you, I will study this attribute to see if I can find a solution.
Hi @brunce10, is this for an in-proc VSSDK extension? If so, both extensions can provide their own ProvideCodeBase attribute but only if assemblies have different assembly versions (not file version) and types are not shared publicly between components.
Also if this is an assembly that VS also ships with, it could cause larger issues at runtime so for such assemblies we don't recommend using different versions.
For out-of-proc extensions, the load contexts are differents so each assembly can load their own version safely and wouldn't be able to share types directly anyway since communication happens via JsonRpc.
Closing this as this behavior is by design when extensions are running in devenv process..