To keep the directory structure clean, my Visual Studio C++ projects are usually meant to be run from a specific directory, commonly the project root, in order to be able to locate all required resource files, hence, not from the output directory, which I think is reasonable since you don’t want a copy of the resource folders in each possible output directories (x64/x86 x Debug/Release…) in order to run the exe from there.
To accomplish this, I use to set the debugger working directory in the project settings accordingly, i.e., relative to the project directory, such as $(ProjectDir)..\..\. Unfortunately, this is stored as part of the user-specific settings in the .vcxproj.user file, which is bad practice to put into version control, such as Git. However, if I don’t add it to the repo, I (and every other user) have to fiddle around every time I clone, hence, the project is not useable out-of-the-box and requires manual tweaking and according instructions in the README, which is also not great. Also I don’t think implementing in the executable a mechanism to looking up several locations relative to the CWD is the ideal solution.
The way I see it, the working directory is not a user-specific setting, but is instead project-specific, so it should not be stored in the .vcxproj.user file in the first place. I read as a solution that you could add the LocalDebuggerWorkingDirectory entry in the .vsxproj file manually, using a text editor, which does not seem like a viable solution — I expect this to be overridden by the VS IDE at some point, again causing hickups.
Question: how do I deal with this, what is an elegant solution for this, or what is best practice?