Summary
I have a code analyzer I've written. This analyzer is being used in another project. I would like to define attributes in the analyzer that the utilizing project can use to direct the analyzer's behavior.
Question
What is the proper way to define attributes for a code analyzer, and expose them to utilizing projects?
Current Approach
My current approach defines a separate Analyzer.interface project that Analyzer depends on. Analyzer targets .NET Core 2.0, while Analyzer.interface targets .NET Framework 4.0. Analyzer.Interface only declares the attribute classes that I need. The UtilizingProject targets .NET Framework 4.0 and uses this analyzer.
This works, however it has several issues.
First, when building the analyzer, it gives warnings:
"ProjectReference Analyzer.Interface was resolved using '.NETFramework,Version=4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'"
This doesn't appear to break anything, but indicates to me that I am likely approaching this incorrectly.
Second, when updating the utilizing project from .NET Framework 4.0 to .NET Framework 4.7.1, it now reports:
"Unable to find package Analyzer.Interface"
Ideal Solution
The ideal solution that I'm looking for would not cause any warnings, and would be flexible enough to be used in a wide array of projects, independent of version. I see no reason that versioning should be critical for an analyzer, so this seems like it should be feasible, but if it's not I welcome an explanation as to why. I am willing to consider alternate approaches if there is a more "standard" way of handling this situation (my searches have not yielded any relevant results).