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

2

23

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

Unilobed answered 27/2, 2014 at 23:56 Comment(0)
B
52

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
Bemean answered 28/2, 2014 at 0:12 Comment(3)
I don't think that this is really faster then opening it in Notepad++. Especially, I would prefer to have some search and replace functionality in all project files (not only a single one).Penknife
Agree - I usually just open and edit it in Notepad++ and then reload the project in Visual Studio after.Bemean
Unloading in VS is useful when you do Diff comparison in Team Explorer.Sardonic
G
1

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

Galactometer answered 28/2, 2014 at 0:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.