I have Resources.resx, which is used to generate Resources.designer.cs. Should Resources.designer.cs be checked in, or can I rely on Visual Studio generating it when require
I'm not 100% sure about the build scenarios around this file. I think that it's likely Studio, or more appropriately msbuild, will re-generate the file every time you build your application but not sure.
Either way, I would still check this file in for a couple of reasons
The first reason being the most important
My preference is: If it's modified by the build system, ensure the build process will create it and don't check it in.
For autogenerated files like 'designer', I check them in. They only get modified when other components get changed (by me). It's generated by VS and not modified by the build system.
I ran across your post for a problem I am experiencing, not quite the same, but it helped me find a temporary solution. This is what I found that might help you…
I am creating a simple string resource file. I then use a modified CodeProject program that translates it into foreign languages. (We will use professional services once we stabilize the code) The utility does not create the designer.cs files. Doing a rebuild all did not re-create the files either. It appears that any time you use an external tool (not the Visual Studio designer) to modify an resx file, you will lose those synced changes. In my case the designer file is used merely to strongly type the strings to property names. If you are using the ID’s to pull the string (age old method) then you won’t need these files at all and thus wouldn’t need to check them in to source control. However, if you are using the strongly typed access to these string (more modern method) you should check them in.
As an aside… I did find a way to re-sync those designer.cs files with their resx counter parts as that was my problem… I needed them. Selecting a resx file in the Solution Explorer and setting the CustomTool property to PublicResXFileCodeGenerator instantly created the designer.cs file. Unfortunately, if it is already set, you have to un-set it and then re-set it to create the file. If anyone knows a way to force a re-creation of these via some automated means… I would really appreciate it.
Thanks.