'Dependent packages not included in NuGet package or VSIX installer for the analyzer
Using a template provided with Visual Studio 2022, I have created a Roslyn code analyzer. This is results in multiple VS projects - the analyzer assembly, the code fixes assembly, test assembly, and then projects to generate either NuGet package or VSIX package with the analyzer.
My analyzer assembly depends on some packages (to give an example, Microsoft.Extensions.FileProviders.Physical, but there are others as well).
My problem is that neither the NuGet package nor the VSIX package contains the dependent assemblies or a reference to the dependent package that would cause them to be resolved by Visual Studio. Consequently, the analyzer fails in runtime with "FileLoadException" when it comes to do something related to the missing dependent package.
It almost seems like that the analyzers can only be written in a "self-contained" way, without dependencies on other packages? I find it hard to believe, because that would be extremely limiting - so I guess I must be understanding something wrong.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
