Search Unity

Question Make Microsoft.CodeAnalysis.CSharp.CodeStyle work in Unity

Discussion in 'Scripting' started by Azirell, Apr 24, 2023.

  1. Azirell

    Azirell

    Joined:
    Oct 16, 2015
    Posts:
    29
    Pls, help. I cannot make Microsoft.CodeAnalysis.CSharp.CodeStyle work as other .net analyzers. Basicaly it does not produce any warnings/errors in Unity console when I add it as RoslynAnalyzer .dll to my project and set all of its rules to produce errors.

    From what I've investigated is that this library does not work on build by default in VS. It says that property EnforceOnBuildCodestyle .csproj has to be set to true, which I've done already and it does not help at all. But that is not for sure that it works that way, on the .net analyzers github project forum one of the devs told that this property works only for IDE.

    Any ideas?
     
  2. Azirell

    Azirell

    Joined:
    Oct 16, 2015
    Posts:
    29
    Update: problem solved. The issue was in .dll version. It has to be in sync with Unity's Microsoft.CodeAnalisys.dll that untiy uses under the hood.