I recently created a custom error pages feature that was scoped to “WebApplication”. I ran the STSADM “addsolution” command then went to Central Administration -> System Settings -> Manage farm solutions -> mySolution.wsp -> Deploy Solution. I noticed that the “Deploy To?” value was set to “This solution deploys globally.” and no configurable options were given. In order to get a list of web application options in the “Deploy To?” setting, I had to add a SafeControl to the package manifest of the solution, in Visual Studio. It was a really simple fix. Here is what I did:
- Open your solution in Visual Studio
- Solution Explorer -> Package -> (double click) Package.package
- Click the “Manifest” button near the bottom of the Package.package window
- Click the “+” button next to “Edit Options” to expand the manifest template area
- Click the “(Open in XML Editor)” link
- Here is what my Package.Template.xml contained before modifications:
<?xml version=”1.0″ encoding=”utf-8″?>
<Solution xmlns=”http://schemas.microsoft.com/sharepoint/”>
</Solution> - Here is what my Package.Template.xml contained after modifying and saving (be sure to change “mySolution.dll“):
<?xml version=”1.0″ encoding=”utf-8″?>
<Solution xmlns=”http://schemas.microsoft.com/sharepoint/”>
<Assemblies>
<Assembly Location=”mySolution.dll” DeploymentTarget=”GlobalAssemblyCache”>
<SafeControls>
<SafeControl Assembly=”$SharePoint.Project.AssemblyFullName$”
Namespace=”$SharePoint.Project.FileNameWithoutExtension$” TypeName=”*” Safe=”True”></SafeControl>
</SafeControls>
</Assembly>
</Assemblies>
</Solution> - Then I did a rebuilt the solution (not sure that it was necessary) and I repackaged the solution. This updates the .wsp file.
- Make sure the existing “mySolution.wsp” is removed from Central Administration’s farm solutions gallery.
- Run the STSADM “addsolution” command for the updated .wsp file
- Central Administration -> System Settings -> Manage farm solutions -> mySolution.wsp -> Deploy Solution
- In the “Deploy To?” setting, you should now see “Choose a Web application to deploy this solution:” along with a drop down list of web applications to choose from