3

I have a visual studio extension (deployed as .vsix) that needs to support both Visual Studio 2013 and 2015.

The problem is that the extension needs to talk to TFS so it uses the TFS client libraries and in VS2015, these were changed from being GAC deployed to be a nuget package that the consuming app should redistribute.

How should I setup my VS package's references so that it works on both versions of Visual Studio?


I've tried several approaches:

  1. Reference the 2013 GAC dll's: When loading on a VS2015 machine, these DLLs cannot be found.
  2. Reference 2013 GAC dll's but also copy-local (bundle with .vsix): Some other dependency of those DLLs were missing.
  3. Reference 2015 dll's (from nuget) and bundle with .vsix: Loads fine in both 2013 and 2015, but doesn't work in 2013 (actually using TFS functionality fails - for example a call to GetLocalWorkspaceInfo("c:\src\path") returns null)
Community
  • 1
  • 1
Isak Savo
  • 34,957
  • 11
  • 60
  • 92

1 Answers1

2

I would:

  1. Reference the 2013 assemblies, so that you ensure that you only use the API that's available in that version. (2015 is, of course, backward compatible.)
  2. Add an AssemblyResolve hook so that you can load the 2015 assemblies in place of the 2013 assemblies, when they fail to load. Instructions for previous versions are available, but should be similar.

I think that option 3 will mostly work, but the reason your workspace can't be found is because 2013 and 2015 use different workspace caches. I suspect that you could surmount this by building another connection to the server and updating the workspace cache into the 2015 location. Though this points to deeper issues in compatibility: you would be unable to hook up event listeners for VS connection/workspace objects.

Edward Thomson
  • 74,857
  • 14
  • 158
  • 187
  • Should I still bundle the 2015 assemblies with the exxtension, or am I guaranteed that they are installed with vs2015? – Isak Savo Oct 01 '15 at 12:35
  • They're installed with every 2015 SKU - I recommend you use those. – Edward Thomson Oct 01 '15 at 13:43
  • Thanks. This approach sounds like it would work so I'm accepting the answer even though the approach we settled on was providing two separate extensions - one for vs2013 and one for vs2015. – Isak Savo Oct 01 '15 at 14:16