13
\$\begingroup\$

We are experiencing some problems with GIT and Unity. It occurs pretty often that file .sln / .csproj give us some trouble, so after searching for a while on the web I've found that maybe this files are not necessary to push. Someone have any feedback for this? https://gist.github.com/hw/1234398 There for example are included into the .gitignore, but I honestly don't know what this kind of files does.

Can I exclude they from my repo or this file are relevant for some references in my game?

\$\endgroup\$
21
\$\begingroup\$

From my personal experience, I noticed it is better to exclude *.csproj and *.sln from source control: Unity generates these files each time you open a project or add/delete source files anyway, so you won't miss them. You can also do it manually via "Sync MonoDevelop Project" menu item.

It is especially useful to exclude them if there is more than one developer on the project, because the auto-generated content of these files can be different for each user (that depends on Unity installation path and probably some other factors), which may cause a lot of unnecessary file changes committed to the repository.

\$\endgroup\$
  • 4
    \$\begingroup\$ You should also be excluding the entire Library/ folder. \$\endgroup\$ – michael.bartnett Feb 28 '13 at 15:19
  • \$\begingroup\$ You forgot to write that it's only working with MonoDevelop and VS 20xx. This is totally wrong because using vscode or rider unity won't create any files even if you add new c# script or restart unity \$\endgroup\$ – Herrgott Aug 11 '18 at 12:30
2
\$\begingroup\$

I never check in the .sln or csproj. I only check in the actually unity project. Let unity manage the solution files for you. It can be a headache if some forgets to check in only one of the .csproj from the editor folder or something. So if a new coder comes in, they check out the repo and double click a file with mondevelop or vs.

I also make sure to do an Scn ignore on all those files too, so the artist don't check them in on accident to lol

\$\endgroup\$
  • \$\begingroup\$ what if new coder doesn't use this monodevelop and can't use vs because he's using linux? \$\endgroup\$ – Herrgott Aug 11 '18 at 12:32
0
\$\begingroup\$

You can safely exclude those files because they are automatically re-generated by Mono. The code inside those files is being read only from open files, not protected DLLs of, for instance, paid plugin.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.