Tip #44: Did you know…How to view the Project File while still in Visual Studio?

If you are developing a web site using the Web Application Project model, then you know that the Project File is an integral part of this model.  In order for a file to be considered part of the Web Application Project, it must be included within the project file.  This is also true of Assembly References and other project metadata settings.  If a file exists in the web’s file-system root, but is not included in the project file, it is not considered part of the project and will not be included in the MSBuild based compilation process.

Since the Project File is so important, there may be an occasion during which you would want to view this file and even edit it manually (although this could be dangerous and is done at the user’s own risk).  Did you know that you don’t have to leave Visual Studio to do this?

Here is how:

  • Turn on ‘Always Show Solution’ via the Tools / Options:  Go to Tools, Options, Projects and Solution, General and check ‘Always show solution’:

ToolsOptions

  • Right-click your Web Application Project node in the Solution Explorer and select ‘Unload Project’.  This will unload the project and cause (unavailable) to be appended to the project’s node in the Solution Explorer:

UnloadProject

  • Now, right-click your Web Application Project (unavailable) node in the Solution Explorer and select ‘Edit WAP1.vbproj’:

EditProj

  • At this point, the project file will display in the editor.  It can be reviewed and even changed (just don’t forget to save it if it is modified).  Once finished with the project file, right-click the project’s node in the Solution Explorer again and choose ‘Reload Project’:

ReloadProject

  • A dialog will appear stating that the project file is already open and asking if it should be closed or not.  Answering ‘Yes’ closing the project file and reloads the Web Application Project.  Answering ‘No’ leaves the project file open and does not reload the Web Application Project.

question

Thanks,
Nichole Baker
SDET, Visual Web Developer