❔ Source Generator does not work in .NET CLI
When I compile my project in Rider, everything works fine:
but when I try to build it with the CLI (
dotnet build
or dotnet publish
), I get the following:
In my .csproj I included the source generator with a project reference:
The source generator generates the following:
and in code I do the following:
I tried both net8.0
(preview 2) and net7.0
, with and with-out <PublishAot>true</PublishAot>
.
What am I missing? Should I try to remove the preview SDK and see if it works..?2 Replies
Ah, for now I found a work-around for my initial problem. I couldn't use
Activate.CreateInstance
on my type. So I've added the following:
on the assembly attribute that registers the control. Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.