Skip to content

Stratkit Solution Generator Utility

Small editor utility to allow recreating the C# solutions in Unity.

The recommended way to create the VisualStudio SLN from the command line is a call Unity.exe -executeMethod "UnityEditor.SyncVS.SyncSolution"

Unfortunately, as of Unity 2021.3.21f1 the built-in UnityEditor.SyncVS.SyncSolution internally calls Unity.CodeEditor.CodeEditor.Editor.CurrentCodeEditor.SyncAll() where CurrentCodeEditor depends on the user preferences which may not actually be set to VS on a CI machine. (See https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/CodeEditor/SyncVS.cs)

As a workaround, this utility allows you to force which IDE do you want to use in order to generate the C# solution files as follows:

$UNITY_EDITOR_PATH -batchmode -nographics -logFile unity_sync_solution.log -executeMethod Stratkit.SolutionGenerator.Editor.SyncSolution.SyncVisualStudio -projectPath $PROJECT_PATH -quit
You can choose which IDE to sync by specifying the right method: - SyncVisualStudio: uses Visual Studio. - SyncRider: uses Jetbrains Rider. - SyncVisualStudioCode: uses Visual Studio Code.