Why does Visual Studio prevent me from seeing the .csproj file, and is there a way to force it open?

B. Clay Shannon picture B. Clay Shannon · Feb 28, 2014 · Viewed 16.1k times · Source

When I sought the hardcoded origin of the port number my Web API uses, I found it in the project's *.csproj file. Yet when I 2-click it from the Find Results window in Visual Studio, it won't open and I'm rather brusquely informed, "The document 'Bla*.csproj' is already open as a project or a solution and cannot be opened in an editor at this time."

To look at it, I have to open it with Notepad++, which shows me what I want:

<WebProjectProperties>
  <UseIIS>True</UseIIS>
  <AutoAssignPort>True</AutoAssignPort>
  <DevelopmentServerPort>28642</DevelopmentServerPort>
  <DevelopmentServerVPath>/</DevelopmentServerVPath>
  <IISUrl>http://localhost:28642/</IISUrl>
  <NTLMAuthentication>False</NTLMAuthentication>
  <UseCustomServer>False</UseCustomServer>
  <CustomServerUrl>
  </CustomServerUrl>
  <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>

...but this is kind of painful. Is there a quicker way to open a .csproj file from within the project/Visual Studio (2013)?

Answer

Soo Wei Tan picture Soo Wei Tan · Feb 28, 2014

To edit a .csproj (or any other project file) directly from Visual Studio, do the following:

  1. Right click the project in Solution Explorer
  2. Select "Unload project"
  3. Project is now unloaded
  4. Right click the project again and select "Edit blah.csproj"
  5. Make your changes and save them
  6. Right click the project and select "Reload project" to apply the changes