rules_dotnet
rules_dotnet copied to clipboard
Transitive analyzers cause conflicts when strict deps are disabled
There is a simplistic check to elide assemblies when they are already present, but the same isn't done for analyzers: https://github.com/bazelbuild/rules_dotnet/blob/626e28effb14f87de8375186ebb59911a16b71fb/dotnet/private/common.bzl#L315
I ended up having the following compile flags passed down:
/analyzer:external/_main~main_extension~nuget.microsoft.extensions.configuration.binder.v8.0.1/analyzers/dotnet/cs/Microsoft.Extensions.Configuration.Binder.SourceGeneration.dll
...
/analyzer:external/rules_dotnet~~targeting_packs_extension~nuget.microsoft.aspnetcore.app.ref.v8.0.3/analyzers/dotnet/cs/Microsoft.Extensions.Configuration.Binder.SourceGeneration.dll
Which gives me the following compile error:
Microsoft.Extensions.Configuration.Binder.SourceGeneration/Microsoft.Extensions.Configuration.Binder.SourceGeneration.ConfigurationBindingGenerator/BindingExtensions.g.cs(40,10): error CS0433: The type 'InterceptsLocationAttribute' exists in both 'Server, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Server, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
Microsoft.Extensions.Configuration.Binder.SourceGeneration/Microsoft.Extensions.Configuration.Binder.SourceGeneration.ConfigurationBindingGenerator/BindingExtensions.g.cs(40,10): error CS0433: The type 'InterceptsLocationAttribute' exists in both 'Server, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Server, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
Should the same transitive check be added for analyzers?