Microsoft.VisualStudio.ComponentModelHost.dll issues in Visual Studio extensions

I maintain a Visual Studio extension called Unit Test Boilerplate Generator. Recently I went to release a small fix for it but found that I could no longer build it since reformatting my PC. AppVeyor was also unable to build it after I upgraded it to a VS 2019 build agent.

It was complaining about not being able to find Microsoft.VisualStudio.ComponentModelHost.dll v 14.0.0.0 . I had it referenced like this:

<Reference Include="Microsoft.VisualStudio.ComponentModelHost, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />

Many times the answer to these old-style direct references is to change them into NuGet <PackageReference> . When I did that it defaulted to 16.9.227, but that made it incompatible with VS 2017. I downgraded it to 14.0.25424 , and then it built on VS 2019 but still ran on VS 2017. Success!

There is apparently magic binding redirect voodoo built into VS to point all of these references to old versions to the proper modern versions on later VS versions.

Leave a Reply

Your email address will not be published. Required fields are marked *