Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I put Settings.Designer.cs under Version Control?

Visual Studio autogenerates this file. Searching for info on it tells me to never edit this file. Fine, but do I need to store it in my VCS or can VS auto-regenerate it whenever needed?

like image 275
Wilbert Avatar asked Feb 10 '14 14:02

Wilbert


People also ask

What is the settings designer cs?

Answers. The Settings. designer. cs file is the automatically-generated settings that you edit in the Settings.

What is resources designer cs file?

This class is contained in the Resources. Designer. cs file which is nested under the Resources. resx file in Solution Explorer. The Resources class encapsulates all your project resources into static readonly get properties as a way of providing strongly-typed resources at run-time.

What is ASPX designer cs file?

aspx. designer. cs file contains all the definition of the controls that are being used by the page. It's just segregation of the code using partial class feature.


1 Answers

I believe that Settings.Designer.cs and other similar files should be under version control.

I ran into problems using the advice of the other answer here on this question.

Settings.Designer.cs is only modified if changes are made to Settings.settings, and it is auto generated by Visual studio, but not by build tools.

When I removed Settings.Designer.cs I ran into issues where Visual Studio wasn't auto-generating the file when expected, and I had to do several rebuilds/reloads of my project until finally it randomly appeared, and I'm not sure what actually triggered it.

Also I was having issues on our TeamCity build server because the build tools there were not generating the file, so I had build failures saying it was unable to find Settings.Designer.cs

I found a good rule of thumb in this answer on another question, that basically if the build system modifies the file, then don't put it in source control, but if it is only modified when you make changes to another file and is generated by visual studio, then it probably should be in version control.

Also, Visual Studio 2017 can automatically create a Git repo with a .gitignore file when creating a new project, and by default all of the *.Designer.cs files are included in the Git repo.

like image 143
TJ Rockefeller Avatar answered Oct 27 '22 23:10

TJ Rockefeller