user524351
user524351

Reputation: 311

.vcxproj in source control

I have been reading lots of questions regarding whether vcxproj files should be added to source control or not. The consensus seems to be that they should, but when opening the files I noticed that there are a lot of user specific paths contained within.

Seeing as this is a project that is being worked on by a number of people, should I still add it to source control? It seems like it would clash with other peoples' setups.

Upvotes: 18

Views: 19237

Answers (4)

ScaledLizard
ScaledLizard

Reputation: 181

Another useful way of handling paths is via environment variables. You can evaluate variables like $(PythonDir) to control paths without putting them in vcxproj file. This works if you use cmake or vcxproj files directly.

Upvotes: 0

MHebes
MHebes

Reputation: 3227

Just want to pull OPs comment into an answer for future visitors.

I didn't [add absolute paths] but these files were automatically generated by CMake. Perhaps CMake added them. Not sure why it would though.

If you’re using CMake, then vcxproj files are considered build artifacts and should NOT be committed into version control.

If you are using Visual Studio as your build system, and not using CMake to generate vcxproj files, then you SHOULD commit the vcxproj file.

Upvotes: 1

Praetorian
Praetorian

Reputation: 109159

Of course they need to be added to source control, .vcxproj is the project file. Quoting MSDN:

Project files no longer use the .vcproj file name extension. Visual Studio automatically converts project files that were created by an earlier release of Visual C++ to the format that is used by the current system. For more information about how to manually upgrade a project, see /Upgrade (devenv.exe).

In the current release, the file name extension for a project file is .vcxproj.

The .vcxproj.user files, on the other hand, do not need to be added to source control. The link above describes what each of these files contain as well.

Upvotes: 26

Hans Passant
Hans Passant

Reputation: 941635

It is the project file for your project. So yes, you'd better check that in. The only file that you might not want to check-in is the .vcxproj.user file. It contains user-specific overrides, particularly debugger settings.

You could only make such a mistake if you are not operating Explorer in "programmer" mode. It has the nasty habit of hiding filename extensions. Fix that with Control Panel + Folder Options, View tab, untick the "Hide extensions for known file types" checkbox.

Upvotes: 7

Related Questions