2

I have made a log of updates to my Visual Studio package in a version which only targets Visual Studio 2019. One change that I started using the NuGet package Microsoft.VisualStudio.SDK, version 16.0.202 and removed a lot of separate references to DLLs.

Now I have ported the latest version of my package back to Visual Studio 2017 and downgraded several NuGet packages (for example Microsoft.CodeAnalysis) to older versions.

I have downgraded Microsoft.VisualStudio.SDK to version 15.9.3, which is the oldest available version.

Initially, this seemed to work fine on several systems. However, on one system my package is not loaded and a message is written to the Activity Log, something like

Could not load file or assembly 'Microsoft.VisualStudio.Threading, Version=15.8.0.0

(The message is actually in German, but that is the equivalent message in English.)

I can see two possible solutions:

[1]
Throw out Microsoft.VisualStudio.SDK and go back to referencing lots of separate DLLs.

I would prefer not to do that.

[2]
Increase the minimum required version number of Visual Studio.

Using Microsoft.VisualStudio.SDK version 15.9.3, would I have to set the minimum version of Visual Studio to 15.9.3?

(That would be restrictive, but better than a package that doesn't load.)

Phil Jollans
  • 3,605
  • 2
  • 37
  • 50
  • I have that version as well, but I also have a version in the identical directory for 2017. However, I have updated Visual Studio 2017 to version 15.9.16 on my machine. I am guessing that the specific user does not have such a new update. – Phil Jollans Nov 05 '19 at 22:22
  • I have found that I am referencing the packages Microsoft.VSSDK.BuildTools with version 16.2.3073 and Microsoft.VisualStudio.Threading.Analyzers with version 16.3.13. Any version starting with 16 is likely to be too new for VS 2017. I will try downgrading these two packages. – Phil Jollans Nov 05 '19 at 22:28
  • Right, I don't. I gave up chasing that agile bouncing ball at VS2017 version 15.5.6. Painful, isn't it. – Hans Passant Nov 05 '19 at 22:34
  • Thanks. Modifying the versions of Microsoft.VSSDK.BuildTools and Microsoft.VisualStudio.Threading.Analyzers is not going to provide a quick fix. Short term, I have raised the minimum required version. – Phil Jollans Nov 05 '19 at 23:10

2 Answers2

3

Increasing the minimum required VS version is necessary.

1.For packageReference format, if one project references the Microsoft.VisualStudio.SDK package, this project actually depends on the nuget packages the Microsoft.VisualStudio.SDK depends on. We call them nuget package dependencies.

2.And for Microsoft.VisualStudio.SDK package with version 15.9.3, it also depends on Microsoft.VisualStudio.Threading package.(At least 15.8.132, by default nuget will download the 15.8.132)

So your extension project actually depends on Microsoft.VisualStudio.Threading.dll 15.8.0.0.

3.And for Microsoft.VisualStudio.Threading.dll under path C:\Program Files (x86)\Microsoft Visual Studio\2017\xxx\Common7\IDE\PrivateAssemblies, for VS2017-15.9.16, its version is 15.8.0.0. For VS2017-15.0.0, its version is 15.0.0.0.

Then if I have a VS2017-15.6.x, I could have the Microsoft.VisualStudio.Threading.dll whose version in this scope [15.0.0.0,15.8.0.0). If we install the extension which depends on that assembly with version 15.8.0.0 into an older vs version than 15.8.x, we'll meet similar issue.

I can see two possible solutions

I think your user could be in a similar situation with an older vs version. And if he updates vs to latest vs2017-15.9.17, this issue will go away. And yes, if you using Microsoft.VisualStudio.SDK version 15.9.3, please set minimum version of Visual Studio to 15.9.3.

You can check the dependencies there:

enter image description here

This package also depends on packages with 15.9.2x, even 15.9.3 versions. To avoid meeting similar issues like Could not load file or assembly 'xxx, Version=15.9.0.0, increasing the minimal requirement to make VS version consistent with the VS SDK version is recommended. (In VS with version 15.9.0, we may not meet issue like can't load xxx with 15.8.0.0, but we may encounter issue like can't load xxx with 15.9.2.0)

Hope it helps :)

LoLance
  • 25,666
  • 1
  • 39
  • 73
  • Thanks Lance, I will update the minimal requirement to VS 15.9.3. I will also try to make a version without using the Nuget Package Microsoft.VisualStudio.SDK (although that did make life a lot easier) to support older versions. – Phil Jollans Nov 06 '19 at 09:00
1

Using VS 2022 I have mange to solve this issue by install/update those nuggets

Image showing the needed nuggets

Yossi Sh
  • 11
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 03 '22 at 19:33