2

I have used visual studio 2010 express for a while and have played with some extensive projects for quite some time. Since i'm nearing 50-60 files and thousands of lines of code, i've decided to do some source control for everything so that the project is more easily updated and accessible between all my devices, while also being back up.

I have used git before and am comfortable with it, but now when i made the commit and pushed it to a remote repository on bitbucket.org, i found that the .vcxproj files, while still retaining their correct file structure, also retained the include and lib directories for the device it was pushed from, meaning that when pulled down to another computer, those include/lib directories would be looking in the wrong directories, meaning i have to revise all of them every time i pull/push.

My question, Is there anyway i can push files to the repository such that the solution keeps the folder setup, but not the include and lib directory settings?

Edit:

After some research, i went looking into these so called property sheets in visual studio which are files that can be added to your project. The settings you set their take precedence over the settings of the project, but then the snag there is, if you add the individual property file to the project and then push the the .sln file, and the various .vcxproj files without that .props file, and then someone else clones from the repository, it won't open because it apparently requires that props file.

What i would like along these lines is a default .props file in the remote repository that, when cloned over, is no longer tracked, and then that user can just edit it for themselves. I don't know enough about git thought to make this happen. Does anybody have an idea?

FatalCatharsis
  • 3,407
  • 5
  • 44
  • 74
  • I'm afraid that isn't possible. Perhaps you can set up versions without this stuff in the offending files in the pre-commit hook? Or perhaps there is a way of setting them up so they `include` (à la C) the local configuration, and keep those pieces in non-version-controlled files, to be set up by each user? – vonbrand Feb 05 '13 at 21:16
  • Does not answer your question, but I like to use CMake to generate visual studio projects. CMake has a lot of advantages. Also, I would like to show you a cmake code that I created to sort the source files in the generated Visual Studio Project: https://github.com/Andrepuel/ThirdParty.cmake#source-group-tree – André Puel Feb 06 '13 at 01:46

2 Answers2

1

I'm not sure what your problem is exactly, but here's my understanding:

  1. Your project files contain absolute paths (e.g. "C:\myproj\include"). Replace these with relative paths (e.g. ".\include"). The "$(SolutionDir)" variable helps: if your solution file is C:\myproj\myproj.sln, then "$(SolutionDir)include" is the same as "C:\myproj\include". You can change the include and library directories in Project Properties > Configuration Properties > C/C++ and Linker, respectively.

  2. Your project requires third party libaries - such as boost - and these are outside your project, say C:\boost. Unfortunately Windows/VS doesn't have a standard location for third party libraries, so you can either:

    • Include the library in your project. This is perfectly fine for small libraries, but it's not something you'd want to do with something like boost, which is both big and tends to be used widely.
    • Mandate that all devices set up these libraries in the same location, e.g. C:\sdk
    • Use an environment variable, like $(SDK_DIR) in the project, and all devices must set this environment variable.

Let me know if this helps.

congusbongus
  • 13,359
  • 7
  • 71
  • 99
  • actually its both 1 and 2. There are some files in a project that another project needs, but the problem is ($SolutionDir) is a different directory on the other machine, but the value it relates to stays the same as on this machine. For problem 2, i do need boost, but i'd seriously like to avoid forcing them to be located in the same path name on each machine. – FatalCatharsis Feb 06 '13 at 00:56
0

What you're after are git's smudge and clean filters. You'll have to write a script for the cleaning, but sed'll probably do the job just fine, you won't need real xml parsing.

jthill
  • 55,082
  • 5
  • 77
  • 137