Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jbachelor/d1bf231db06b82dccbf1f3e9dfcb74d2 to your computer and use it in GitHub Desktop.
Save jbachelor/d1bf231db06b82dccbf1f3e9dfcb74d2 to your computer and use it in GitHub Desktop.

Should Xamarin.Android/Resources/Resource.designer.cs be in source control?

All I have to do is open up a Xamarin.Forms solution file and build, and I typically see a huge number of changes to the Xamarin.Android/Resources/Resource.designer.cs file. The same occurs for other developers on my team. If we are each working on a feature branch of our own, this can easily lead to merge conflicts in this Resources/Resource.designer.cs file. As an auto-generated file, should this file even be in source control?

Here are the data points I've gathered so far:

  • An ancient Bugzilla report from 2011 where a user suggests keeping Resources.Resource.designer.cs out of source control... But the bug was closed without any action.
    • Note that the last response (in 2012) mentions that developers can add this to their .gitignore file if they like. Does this indicate there would be no problem in doing so? It sounds like it.
  • I found a more recent (2016) discussion on the Xamarin forums site asking if one could ignore this file.
    • One user said there 'should' be no problems.
    • Another user referenced the .gitignore file from Xamarin's own samples repository. This does ignore the Xamarin.Android/Resources/Resource.designer.cs file(s). This seems like fairly rock-solid evidence that it can be ignored. But I'm still nervous, since a new Xamarin.Forms app doesn't ignore this file by default in Visual Studio.
    • Finally, a third user generated a .gitignore using gitignore.io (generated file here), and found that it did not ignore the file.

To ignore, or not to ignore?

That is the question, my fellow developers. It seems safe, but I'd love to hear your opinions in the comments below!

2020.08.03 Update

After running a quick twitter poll, Dan Siegel weighed in with some very solid reasoning and advice. The conclusion I've come away with is that it's perfectly fine, and IMHO preferable to ignore this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment