When I install Roslyn code-analyzer as NuGet-package for a project (say Assembly-CSharp
) of solution of my Unity-project, 2 things happen:
- package is installed to Packages folder at Unity-project root
- and lines like
<Analyzer Include="packages\SomeAnalyzer.1.2.3\analyzers\dotnet\cs\SomeAnalyzer.dll" />
are added to the.csproj
file (in our caseAssembly-CSharp.csproj
)
The problem is - Unity regenerates .csproj
file (f.e. when you add or remove .cs
files or when you close and reopen Unity editor). Regeneration of .csproj
erases added lines, mentioned above. And analyzers stop working.
Looks like for Unity 2020 the problem is solved: (Unity - Manual: Roslyn analyzers and ruleset files). But my project is on Unity 2019 & could not be updated to 2020 now.
So I my question is: Is it possible to add code analyzer to Unity-project and make it work for Unity versions below 2020?