7

I'm planning on creating a few related C++ projects which will all have several settings in common (output path, exe naming convention, intermediate directory, ...) and I've managed to set most of the ones I need except the working directory:

enter image description here

It's set to $(ProjectDir) by default but I want that to be $(OutDir) instead and I was hoping to achieve this through a Property Sheet.

Unfortunately the property sheet itself (not the property pages of the project shown above) doesn't seem to contain a "Debugging" section:

enter image description here

Is it possible to override the Working Directory value using a property sheet in VS 2015 Community Edition (Update 3)?

Rakete1111
  • 47,013
  • 16
  • 123
  • 162
Borgleader
  • 15,826
  • 5
  • 46
  • 62
  • Does this answer your question? [Can the working directory be set in the project (.vcproj) file?](https://stackoverflow.com/questions/846180/can-the-working-directory-be-set-in-the-project-vcproj-file) – Derek Oct 21 '22 at 13:28
  • @Derek Incorrect duplicate, I was asking about property sheets specifically, not the vcproj. – Borgleader Oct 21 '22 at 14:33

1 Answers1

8

Apparently, these settings are normally stored in the foo.vcxproj.user file (if changed from the defaults), but can be put in a property sheet instead. Putting this in your property sheet should do what you want:

<PropertyGroup Label="Debugging Properties">
    <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
melak47
  • 4,772
  • 2
  • 26
  • 37
  • Adding this to the vcxproj seemed to work for me. NOTE: I had to specify one property group for each of Release|x64, Debug|x64 etc. It didn't seem to work for me without the conditions. – Derek Oct 21 '22 at 13:32
  • @Derek It worked for both configurations (Debug, Release) in my case. It may depend on where you put the `PropertyGroup` in `.vcxproj`. – Burak Oct 24 '22 at 07:31