1

I'm trying to automate some VS2015 project setup for automated VM deployments. But I cannot discover where Visual Studio 2015 stores the Web->Specific Page setting, as shown in the screenshot. I saved the setting.

enter image description here

I have looked in the most obvious files: MyApp.csproj and MyApp.csproj.user. Not there. I ran AstroGrep against the entire folder tree. Nothing. It must be storing that somewhere because I can close VS, reopen it, and the setting has persisted. Is it in a registry key or some out-of-directory location someplace?

HerrimanCoder
  • 6,835
  • 24
  • 78
  • 158
  • Have you clicked the "save all" button after modifyng it? Visual Studio is particularly lazy in saving changes to the project and user files. BTW, my guess would be that it's in the project file, but haven't tried yet. – Alejandro Jan 10 '18 at 17:52
  • AGGGG!! You are right!! VS didn't save it until I clicked Save All. Want to submit that as the answer? I'll accept. And it saves to the .csproj.user file. – HerrimanCoder Jan 10 '18 at 17:56
  • Give me a few minutes and I'll convert into a real answer. Fall into that gotcha countless times. Not that funny when adding new files and the commit into source control didn't update the project itself :P – Alejandro Jan 10 '18 at 17:59

1 Answers1

3

The setting is actually saved into the .user file on each project. This is a per-user XML file that contains some settings about the project (while others end up in the project file itself). The full relevant XML parts look something like this:

<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <StartPageUrl>ACTUAL PATH GOES HERE</StartPageUrl>
          <StartAction>SpecificPage</StartAction>
          <AspNetDebugging>True</AspNetDebugging>
          <SilverlightDebugging>False</SilverlightDebugging>
          <NativeDebugging>False</NativeDebugging>
          <SQLDebugging>False</SQLDebugging>
          <ExternalProgram>
          </ExternalProgram>
          <StartExternalURL>
          </StartExternalURL>
          <StartCmdLineArguments>
          </StartCmdLineArguments>
          <StartWorkingDirectory>
          </StartWorkingDirectory>
          <EnableENC>True</EnableENC>
          <AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

An important aspect of this file, as well as the project file, is that they don't get saved to disk until you press the "save all" button, or compile the project or quit Visual Studio, it remains in the old state until then. That's why any external tools fail to find it. Just force saving and search again and you'll find it.

A bit unrelated, but also note that it's often recomended not to commit the .user file into source control so if you're using this setting be sure to set it again whenever you checkout a new working copy. Otherwise other copies will still get the default.

Alejandro
  • 7,290
  • 4
  • 34
  • 59