ReSharper InspectCode command line tool with Unity3D project

I have a problem with InspectCode CLI and unity project: when I run InspectCode with --no-build option result xml file contains thousands of compile errors which are not present in Rider - for every namespace it is a "Cannot resolve symbol" error. As a result, project is successfully compiled by Unity but Resharper finds lots of non-valid errors.

I tried to run inspection with --build option and it fails with error: 

[MsBuild] /usr/local/share/dotnet/sdk/5.0.302/Microsoft.Common.CurrentVersion.targets (2202,5)->(2202,5) MSB4018: The "ResolveAssemblyReference" task failed unexpectedly. System.IO.IOException: The process cannot access the file '/PathToMyProject/Temp/Bin/Debug/System.Xml.dll' because it is being used by another process

I tried it several times and every time it was a different .dll file in the error message. There had not been any result.xml file when the command was finished.

Also, is it possible to set Scripting Define Symbols via CLI somehow? When Unity compiles solution it set UNITY_EDITOR define symbol, but I want to inspect code for production version of solution, where UNITY_EDITOR is not set, but specific platform defines are set instead.

Unity version: 2020.3.14f1
Rider version: 2021.1
ReSharper CommandLineTools version: 2021.3.2

1 comment
Comment actions Permalink

Hello Afedulov,

I'm sorry for the late reply. Which OS do you run? Are you able to build the same solution using the dotnet build command?


Please sign in to leave a comment.