Search code examples
gitnugetgit-mergesolutionnuget-package-restore

Why sometimes the nuget packages fail after merging in git


I had a problem about nuget packages sometimes when i merge two branches in git. I search and found which the problem is about solution user options(.suo) file, then after removing it and restarting the visual studio, all the errors gone. Why this happen? what can I do to avoid it? I know that .suo file should't checked in source control and check my git repository for it, nothing found.


Solution

  • Just to be safe, make sure that your .gitattributes file includes a newline with *.suo binary so that git does not try to merge them. Otherwise, git will try to merge the .gitattributes from both branches and create errors.

    Also make sure to put *.suo in your project's .gitignore.