Saturday, June 2, 2012

Updating the Site URL Property of Your SharePoint Development Project

I admit my Visual Studio 2010 and SharePoint development skills are a little rusty.  After all, I have spent the last year or so engaged solely in SharePoint and information architecture planning.  But that doesn't take away from the fact that SharePoint and Visual Studio development can be more than a little kludgy.

When attempting to deploy one of my new projects to my SharePoint server, I received this error message:
Error occurred in deployment step 'Recycle IIS Application Pool': Cannot connect to the SharePoint site. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project.
This is one of the more descriptive error messages I've encountered in SharePoint development.  It seemed easy enough, so I right-clicked my project in Solution Explorer and clicked "Properties."  (You can get to the same place by choosing "Properties" from the "Project" menu.)  That brought up the following:

SharePoint Project Properties Window

I clicked through all the tabs several times, and nowhere did I find a way to view or edit the "Site URL" property.  I even tried editing the solution's properties.  I was in the wrong place.

It turns out I was looking at the "Properties Page."  I needed the "Properties Window."  Why are some properties in a "page" and some in a "window," and why can't the error message specify the "Site URL property (from the Properties Window) of the project"?

SharePoint projects, just like other Visual Studio projects, display properties in the Properties window and the Properties Page. The properties that are displayed depend on the node that is selected.
The article then lists the different properties that are displayed for projects, project items, and project item files.  But it neglects to tell us whether the properties in those lists can be found in the "Properties Window" or the "Properties Page."

Evidently the "Properties Window" in Visual Studio is used to "view and change the design-time properties and events of selected objects…"  Well THAT sure clears it up.

When you go to the "View" menu, you will see both the "Properties Page" and the "Properties Window" (which is where the "Site URL" property is hidden):

Visual Studio View Menu

And now you can see and edit your project's "Site URL" field:

Visual Studio Properties Window