Visual Studios 调试设置保存在哪里?

Where are Visual Studios Debugging settings saved?

当我更改项目属性中的调试设置(在我的例子中尤其是环境值)时,它不会保存到项目或解决方案文件中。

保存在哪里?

这些设置保存在 projectname.vcxproj.user 文件中,该文件与项目文件位于同一目录中。例如:

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

感谢 Stack Overflow 问题 Should I add the Visual Studio .suo and .user files to source control I was able to solve the question with Chris Nielsens 我在这里引用的答案:

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! =)

我刚刚复制了:

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

.user文件到.vcxproj文件再到文档的同一节:

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

在我的例子中,这些是 .user 文件中唯一的条目,所以在我的例子中将它们签入 SCM 是可以的,但将它复制到 .vcxproj 文件可能更干净。

如果您使用的是新的 SDK 样式项目,调试设置现在存储在 ./Properties/LaunchSettings.json 中。它们在同一文件夹中的所有项目之间共享。