Unity only supports version 3.8 of Microsoft.CodeAnalysis.CSharp: https://docs.unity3d.com/Manual/roslyn-analyzers.html
Roslynator from what I see is directly using version 4.4.0 right now:
https://github.com/dotnet/roslynator/blob/7bc89125ea3793993a9e47f89872daf212bebe57/src/Directory.Build.props#L16C1-L16C1
This makes it not compatible with Unity:
warning CS8032: An instance of analyzer Roslynator.CSharp.Analysis.AddBracesAnalyzer cannot be created from {UNITY_PROJECT_PATH}\Library\PackageCache\org.nuget.roslynator.analyzers@4.6.0\dotnet\cs\Roslynator.CSharp.Analyzers.dll :
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified..
Another very powerful Analyzer is Meziantou, in this case it is compatible with Unity because it offers the analyzers in different versions of Roslyn:
https://github.com/meziantou/Meziantou.Analyzer/blob/cfa7ab74ad7b31a49efcd467a585e39853f2706b/src/Meziantou.Analyzer.pack.csproj#L19
@josefpihrt would it be possible to do the same with Roslynator?
Thank you!
Unity only supports version 3.8 of Microsoft.CodeAnalysis.CSharp: https://docs.unity3d.com/Manual/roslyn-analyzers.html
Roslynator from what I see is directly using version 4.4.0 right now:
https://github.com/dotnet/roslynator/blob/7bc89125ea3793993a9e47f89872daf212bebe57/src/Directory.Build.props#L16C1-L16C1
This makes it not compatible with Unity:
Another very powerful Analyzer is Meziantou, in this case it is compatible with Unity because it offers the analyzers in different versions of Roslyn:
https://github.com/meziantou/Meziantou.Analyzer/blob/cfa7ab74ad7b31a49efcd467a585e39853f2706b/src/Meziantou.Analyzer.pack.csproj#L19
@josefpihrt would it be possible to do the same with Roslynator?
Thank you!