C#C
C#โ€ข3y ago
QzL

โ” Incremental source generator not called with docker

Hello,

I have 2 projects (simplified):
  • one sandbox .net6
  • one SourceGenerator .netStandard2.0
In my SourceGenerator, I have a class called RestServicesSourceGenerator like this

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;

[Generator]
public sealed class RestServicesSourceGenerator
    : IIncrementalGenerator
{
    public RestServicesSourceGenerator()
    {
    }

    void IIncrementalGenerator.Initialize(IncrementalGeneratorInitializationContext context)
    {
        // processing code
    }
}


And in my sandbox project, I have a reference of my SourceGenerator

<ProjectReference Include="..\..\project.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true" />


When i start building my sandbox (from VS or from command line dotnet build --no-incremental), the IIncrementalGenerator.Initialize is executed and i can see my generated files.

When i start building from docker using this image mcr.microsoft.com/dotnet/sdk:6.0 nothing happens. ๐Ÿ˜ญ

When i start building from azure pipepline using vmImage: 'ubuntu-latest' it's work ๐Ÿ˜…

If someone have an idea ๐Ÿฅน


Deps are :
<PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.5.0" PrivateAssets="all" />


#rosyln
Was this page helpful?