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.)
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:
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 :)