Search code examples
unity-game-engineteamcityresharperrider

How do I check ReSharper code inspections of Unity Project via a command line?


Given:

  • Unity project
  • ReSharper is used to check inspections (IDE Rider)

I want to:

  • Run code inspections on a CI / CD system (TeamCity)

Solution

  • To run inspections from the command line, you need:

    1. Download ReSharper command line tools
    2. Download Unity plugin for ReSharper
    3. Put the plugin in the root of the ReSharper folder
    4. Run the tool: InspectCode.exe YourSolution.sln -o=<PathToOutputFile> More options
    5. Get a beautiful XML report

    TeamCity has a special runner type to run such checks: Inspections (ReSharper)

    In the R# CLT Plugins field, you will need to specify the Unity plugin, for example: Download JetBrains.Unity/2021.2.0.129

    If the .sln file is not generated at the previous steps of building your project, you can generate it with running Unity with the parameter -executeMethod UnityEditor.SyncVS.SyncSolution