13

When I change the Debugging settings in the Project Properties (in my case especially the Environment value) it is not saved to the project or solution file.

VS Property Pages

Where is it saved?

jaba
  • 735
  • 7
  • 18

3 Answers3

9

Thanks to the Stack Overflow question Should I add the Visual Studio .suo and .user files to source control I was able to solve the question with Chris Nielsens answer which I quote here:

You can open both the .user and the .csproj files in any text editor. I just tested copy-pasting the relevant debug settings from the .user into the .csproj, then deleting the .user file. Debugging continued to work, happily reading the correct settings from their new location in the .csproj file. This should provide a way to commit debug settings without committing the .user file. Be sure you put them in the right configuration (debug, release, etc.). Works on my machine! =)

I just copied:

    <LocalDebuggerEnvironment>PATH=$(CxPathd);%PATH%</LocalDebuggerEnvironment>
    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>

from the .user file to the .vcxproj file to the same section of the document:

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

In my case these where the only entries in the .user file so it would be okay in my case to check them into the SCM but it maybe cleaner to copy it to the .vcxproj file.

jaba
  • 735
  • 7
  • 18
  • 1
    Do these fields show up in the Visual Studio GUI for editing project Properties? I tried it and they were blank, although hitting F5 seemed to do the correct thing... – JamEnergy Jan 14 '21 at 16:38
6

Those settings are saved in the projectname.vcxproj.user file, located in the same directory as the project file. It looks like this for example:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ShowAllFiles>true</ShowAllFiles>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <LocalDebuggerCommandArguments>
    </LocalDebuggerCommandArguments>
    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
    <LocalDebuggerEnvironment>PATH=$(CxPathd);%PATH%</LocalDebuggerEnvironment>
  </PropertyGroup>
</Project>
stijn
  • 34,664
  • 13
  • 111
  • 163
2

If you are using the new SDK-style projects, debug settings are now stored in ./Properties/LaunchSettings.json. They are shared between all projects in the same folder.

Artfunkel
  • 1,832
  • 17
  • 23