dotnet/roslyn-sdk

Source generator sample has errors in Visual Studio

parched opened this issue · 1 comments

If I open https://github.com/dotnet/roslyn-sdk/blob/main/samples/CSharp/SourceGenerators/SourceGenerators.sln from a fresh clone in VS I get a lot of errors when I open the demo files.

image

When I build the solution the errors go away.

Is this the intended behavior or is it a bug in VS or in these samples?

The source generator project needs to be built once and then restart Visual Studio for it to take effect. This is a known limitation of source generators that are defined in the same solution where they are used.