C#C
C#5mo ago
gax

Source Generator randomly decided they don't work anymore

I had a source generator that worked exactly like intended, however for some reason it simply does not work and doesnt compile when using the generated code

The issue started randomly, did not change anything in the generator project or the one consuming it

Source Generator csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>true</ImplicitUsings>
    <LangVersion>latest</LangVersion>
    <IsRoslynAnalyzer>true</IsRoslynAnalyzer>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <IncludeBuildOutput>false</IncludeBuildOutput>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" PrivateAssets="all" />
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" PrivateAssets="all" />
  </ItemGroup>

  <ItemGroup>
    <None Include="$(OutputPath)$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
  </ItemGroup>

</Project>


And i use the source generator like so:
      <ProjectReference Include="..\FFlow.Steps.DotNet.SourceGenerators\FFlow.Steps.DotNet.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />


The consuming project does recognize the source generator as an analyzer, just isnt generating the code
image.png
Was this page helpful?