We are working a couple of people on the same project using Visual Studio 2015 and git. This works reasonably well, expect for the .csproj
file (the project file). Everytime you add a new file to the project, the .csproj
file changes automatically. Hence if two (or more) people adds a file to their local version, it will require a merge from the last one who commits.
Is there a way to avoid this?
Edit: I can fetch, but not pull or commit. If I try to pull, Visual Studio Git wants to merge the remote .csproj
file with my local version. It cannot do this automatically however, and every attempt I have made to assist it results in a non-functional .csproj
file.
The .csproj
files Visual Studio creates are XML data. Git does not know anything about XML; it tries to merge these as ordinary text files. The result is rarely valid XML, and even more rarely anything resembling functional.
By default, when Git fails to merge these XML files, you will typically get a merge conflict: Git will stop and make you fix up the mess. It's up to you to get this right. Whether VS provides any tools to help, I have no idea (I avoid Windows). See also this description of the problem (this link is in the linked question's answer as well, but I figure I should include it as a direct link here).
Some people try to use union merge to fully automate the merging of these XML files, so that there is no Git conflict. This is not a good idea. See VS 2013 C# and Git: .csproj files don't merge upon pulling for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With