Issues Deploying SharePoint Solution Packages

Several weeks ago, I converted our deployment process to use SharePoint solution packages instead of the batch scripts that we had been using in our Development environment. One of the issues that I discovered along the way is that SharePoint is rather finicky when it comes to running the stsadm.exe command to deploy your solution package.

I noted in a previous post that we have created a PublishingLayouts feature containing our custom master pages, images, and stylesheets — similar in structure to the feature provided in Microsoft Office SharePoint Server (MOSS) 2007. Creating the WSP file was quite straightforward, as was adding it to the solution store, using the following command:

stsadm -o addsolution -filename Fabrikam.Project1.PublishingLayouts.wsp

However, as soon as I tried to deploy the solution using the following command:

stsadm -o deploysolution -name Fabrikam.Project1.PublishingLayouts -url http://foobar/ -local

I encountered the following error:

This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.

I must have spent 30 minutes trying to figure out why this command did not work (because it worked just fine for other features that I had converted to deploy with WSPs). It turns out that I needed to omit the url parameter:

stsadm -o deploysolution -name Fabrikam.Project1.PublishingLayouts -local

The reason why the PublishingLayouts solution would not deploy with the url parameter is because, unlike the other features, there was no assembly generated for the PublishingLayouts (since it was pure content).

I also encountered the following error when trying to deploy our custom Workflows feature:

Elements of type ‘Workflow’ are not supported at the ‘WebApplication’ scope.  This feature could not be installed.

I found that I had to omit the url parameter for this solution as well.

I then decided to try omitting the url parameter when deploying all of the other solutions. Without the url parameter, I was able to deploy 7 of our 9 features. The remaining two produced the following error:

This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.

For these two features, I had to specify the url parameter when invoking stsadm.exe, because the manifest.xml file for the WSP specifies a <SafeControl> element. When deploying these two solutions, SharePoint needs to know which Web.config file to merge the <SafeControl> elements into, and therefore the url parameter must be specified.

The bottom line is that if your solution specifies elements (a.k.a. “resources”) that need to be merged into a Web.config file (i.e. “for a Web application”) then you must specify the url parameter. If your solution does not have an assembly or if your solution contains workflows, then you cannot specify the url parameter.

Comments (7)

  1. You’ve been kicked (a good thing) – Trackback from

  2. Ed says:

    I used the cmd line prog (stsadm) to add the solution, but used the GUI in SP Admin to deploy it (Central Mgmt–>Operations–>Solution Mgmt) to deploy it.  In the deploy dialog, I was able to select the url to use.  

    I used this method successfully after attempting to use the cmd line prog 1st.  I was getting the dreaded "This solution contains resources scoped for a Web application and must be deployed to one or more Web applications" then.

  3. Dilli says:

    Good explanaion on STSADM options

  4. Anonymous says:

    Thanks. Exactly what I was looking for.

  5. Rakesh Athaluri says:

    It's Awesome.

    Thanks for your Post.

  6. burn1down says:

    thanks for the post, it helped me a lot.

    i was having the  no resources scoped for a Web application and cannot be deployed to a particular Web application error and you were the only one that i found with the true answer.

    i had set my vs project do not include an assembly in the gac cause it was pure content.. i just omitted the url in the Install SP-Solution.. yer my hero for the day.