Visual Studio doesn't recognize generated source code (Roslyn)

I’m using the manual on Roslyn Analyzers, and I have it working in the editor, but visual studio marks the namespace and class name as missing. (Compiler Error CS0246)

Does anybody know how to fix this? I remember reading a similar thread mentioning this problem, but I’m unable to find it again.

Found the post

I think the issue was that the manual doesn’t say you need the SourceGenerator label on the dll too.