Generating .csproj from command line

Hello,

We ran into a problem in our CI/CD pipeline (using Unity 2018.3.11):

  1. We use automatic code generation for some files (using Jenny and Entitas).
  2. The project doesn’t compile right away when cloned from git. It requires code generation to compile. (auto generated files are gitignored).
  3. Code generation (Jenny) requires a .csproj file for the project to generate required classes (which is gitignored as well).

I’m aware of two solutions at this point:

  1. There’s a menu item Assets>Open C# Project in Unity. This is not valid, because I’m running the script from a CI machine and cannot click a menu item :wink:
  2. Run Unity from command line with batch mode (the same way we run it to create build projects from iOS and Android in our pipeline). Unfortunately it’s not possible, because running any method through Unity CLI seems to require the whole project to build.

Is there any other way to generate a .csproj at this point? Or are we required to include either .csproj or autogenerated code in the repository?

1 Like

Already discussed in the past: Any way to tell Unity to generate the .sln file via script or command line?

We are using this solution in our project: https://github.com/nickgravelyn/UnityToolbag/blob/master/SyncSolution/Editor/SyncSolution.cs

1 Like