Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Visual C++ file types should be committed to version control?

People also ask

Does Visual Studio have version control?

Start with Git & GitHub in Visual StudioVersion control with Visual Studio is easy with Git. We meet you where you are. You can work remotely with the Git provider of your choice, such as GitHub or Azure DevOps. Or, you can work locally with no provider at all.

What is a VCX project file?

A VCXPROJ file is a software development project created by Visual C++, a Microsoft Visual Studio component used to develop C++ programs. It contains XML-formatted text that defines a project's content, platform requirements, versioning information, and web server or database server settings.


Yes:

  • cpp: source code
  • filters: project file
  • h: source code
  • ico: resource
  • rc: resource script
  • rc2: resource script
  • sln: project file
  • txt: project element
  • vcxproj: project file

No:

  • aps: last resource editor state
  • exe: build result
  • idb: build state
  • ipch: build helper
  • lastbuildstate: build helper
  • lib: build result. Can be 3rd party
  • log: build log
  • manifest: build helper. Can be written yourself.
  • obj: build helper
  • pch: build helper
  • pdb: build result
  • res: build helper
  • sdf: intellisense dbase
  • suo: solution user options
  • tlog: build log
  • user: debug settings. Do preserve if just one dev or custom debug settings

Several of these are iffy because they can both be auto-generated and maintained yourself. And there are several more that don't appear in your list. Primarily pay attention to the location of the file. If it is in your solution or project directory then it's highly likely you want to check it in. In the Debug or Release subdirectories then highly unlikely. Build + Clean removes a lot of the noise files. And of course: check-in, rename the project directory, check-out and verify that it builds.


From your list I'd choose those:

cpp
filters
h
ico
manifest
rc
rc2
sln
txt
vcxproj

Generally, you should version all files necessary to build the project. Automatically generated files should not be archived imho.


As suggested by Microsoft, filetypes that should be included in version control:

.mak, .dsp, .c, .rc, .rc2, .ico, .bmp, .txt, .def, .hpj, .bat, .rtf, .odl, .inf, .reg, .cnt, .cpp, .cxx, .h, .hpp, .hxx, .inl, .tpl, .vtp, and .mst...

Filetypes that shouldn't be included in:

.pch, .mdp, .ncb, .clw, .obj, .exe, .aps, .cpl, .awk, .exp, .lib, .idb, .opt, .pdb, .map, .res, .ilk, .scc, .bsc, .sbr, .dll, and .tlb...

But in case using an external tool in exe file or external library then I think it should also be included in version control

INFO: Which Visual C++ Files to Add to Source-Code Control

In addition, this link describes the File Types for Visual C++ Projects in Visual Studio 2017.


If you right click over the project there should be a "Add Solution to Source Control" option in the context menu.

If you use this, only those files that are necessary will be added. All the intermediate and output files will be ignored.


The other answers are excellent; I just thought I'd contribute a useful little tool. Check out the Visual Studio .gitignore template on GitHub. It's a nice actively maintained list of files that are commonly kept out of version control.

And while you're at it, the whole gitignore repository is a very useful resource for all sorts of development from ActionScript to Zend. If you don't use Git, you can still use the gitignore files as a reference.