Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 967
B. Clay Shannon-B. Crow Raven Avatar asked Feb 27 '14 23:02

B. Clay Shannon-B. Crow Raven


2 Answers

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
like image 106
Soo Wei Tan Avatar answered Sep 16 '22 19:09

Soo Wei Tan


Right-click project -> Unload project, then right-click again -> Edit

like image 29
robertos Avatar answered Sep 16 '22 19:09

robertos