In my given VSIX I have referenced .netstandard's version of nuget package Microsoft.TeamFoundationServer.Client to get a list of Projects utilizing GetProjects() method of ProjectHttpClient class from Microsoft.TeamFoundation.Core.WebApi.dll assemly.
I get Method not found exception in runtime at the moment of method call.
It took me a long time to learn that, this is because a VSIX is loaded into devenv.exe App Domain which has already loaded the same referenced assembly with a different version (and different signature of GetProjects() method) from the following path:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer.
Some of things that I have done to make it work:
- Manually appending nuegt assembly using
Assembly.LoadFromto the list of loaded assemblies during VSIX'sInitializeAsyncmethod which didn't help. - Trying to point runtime to use that nuget version, using
assemblyIdentity, which turned out to be pointless since it is apparently gets ignored in VSIX packages.(link). - Replace
PackageReferencewith AssemblyReferencepointing to that version of assembly, located in the aforementionedTeam Explorerfolder which solve the problem, but it makes my VSIX tightly bound to the target environment binary versions. which doesn't sounds a logical decision.


