Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change the working directory through VC++ property sheet?

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)?

like image 780
Borgleader Avatar asked May 06 '17 19:05

Borgleader


People also ask

How do I change the target path in Visual Studio?

You can open *. csproject file with any text or XML editor, change the wrong path, then save the file. Then re-open the project with Visual Studio again.

How do I add a .props file to Visual Studio?

right click on the project that you want to add a . props file for and choose "Add Existing Property Sheet". You can also choose to add a new property sheet. I have my property sheet in the same folder as my solution file so that all my projects can use the same property sheet.

How to change or add a directory to a property sheet?

However, if you want to change or add a directory, it is better to use Property Manager to create a property sheet or modify the default user property sheet. For more information, see Share or reuse Visual Studio C++ project settings.

How do I edit a property in the VC++ directories?

Select one of the properties in the VC++ Directories page. For example, choose Library Directories. Choose the down-arrow button at the end of the property value field. In the drop-down menu, choose Edit. You now see a dialog box like this:

How do I access the VC++ directories property page in Visual Studio?

To access the VC++ Directories property page: If the Solution Explorer window is not visible, then on the main menu choose View > Solution Explorer. Right-click on a project node (not the top-level solution) and choose Properties. In the left pane of the Property Pages dialog box, select Configuration Properties > VC++ Directories.

How do I set directories for multiple projects in Visual Studio?

Use this property page to tell Visual Studio which directories to use when building the currently-selected project. To set directories for multiple projects in a solution, use a custom property sheet as described in Share or reuse Visual Studio C++ project settings. For the Linux version of this page, see VC++ Directories (Linux C++).


1 Answers

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>
like image 58
melak47 Avatar answered Nov 09 '22 08:11

melak47