06 March 2012

SharePoint only allows a WSP to be deployed globally

One more reminder to me…

Description of the Problem

I’ve been experiencing a problem where on installing a WSP to SharePoint, it is only possible to deploy the solution globally.

Some of the other posts surrounding this issue talk about the SafeControl entry. However, in my instance, I’m just deploying a bunch of files - to the Master Page Gallery and Style Library. I don’t even want to deploy a DLL as I have no code.

Solution I found

  1. Deploy an assemly to the GAC.
  2. In the Package.Template.xml file, add something like the following:
<?xml version="1.0" encoding="utf-8"?>
<
Solution xmlns="http://schemas.microsoft.com/sharepoint/">
<
Assemblies>
<
Assembly Location="My.Branding.dll" DeploymentTarget="GlobalAssemblyCache">
<
SafeControls>
<
SafeControl Assembly="$SharePoint.Project.AssemblyFullName$" Namespace="My.Branding" TypeName="*" />
</
SafeControls>
</
Assembly>
</
Assemblies>
</
Solution>

After installing this, I can now deploy to any web application. The down side is I’ve now got a DLL polluting in the GAC that I don’t care about.