This is example roslyn analyzer
I just created this using Standalone Code Analisis Tool template in Visual Studio. I changed code only in StringFormatAnalyzerAnalyzer and some resources. There is 5 projects in this templates but you need only StringFormatAnalyzer for analyzer code and StringFormatAnalyzer.Package for nuget package.
To debug analyzer you can add
if(!Debugger.IsAttached)
{
Debugger.Launch();
}in StringFormatAnalyzerAnalyzer.Initialize method.