Building AOT with ProjectReference to source generator #70900
-
We have a test project that references our source generator: <ProjectReference Include="..\..\src\Reaper.SourceGenerator\Reaper.SourceGenerator.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" /> This works fine until we try to compile as AOT, it is trying to compile the source generator too which obviously fails due to the netstandard2.0 target.
The Source Generator is marked as a Roslyn Component and works in other scenarios for AOT (ie. referenced from NuGet). What is the correct way to test this? Our generator is designed to produce code that makes the project AOT friendly, but we would obviously like the ability to test this. The workaround we're using now is to compile the source generator first, get the nupkg and create a target that references this local package. However that seems cumbersome. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This looks like a bug in that something in the AOT pipeline should have filtered out this reference but didn't. I'm asking around internally for where to route this but might be a few days since we're hitting holidays in the United States. |
Beta Was this translation helpful? Give feedback.
-
My guess would be that you publish for AOT by passing the One possible future solution is this: dotnet/msbuild#9415 In any case our recommendation is to set the |
Beta Was this translation helpful? Give feedback.
This bug is now filed: dotnet/sdk#37228