Question

This seems to me an uphill task in SharePoint but is it possible to deploy the WSPs via SharePoint features? For instance, if we activate a certain feature then some specific SharePoint solutions (WSPs) should be deployed on SharePoint farm.

Was it helpful?

Solution

Yes.

You need to get a reference to the solution object itself via SPFarm.Solutions.

Once you have the SPSolution object, call Deploy (SPSolution.Deploy()) to deploy it.

SPSolutionCollection (returned by SPFarm.Solutions): http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spsolutioncollection_members.aspx

SPSolution Members: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spsolution_members.aspx

OTHER TIPS

This seems to me an unnecessarily confusing way of going about things. If you have a feature that depends on another solution I would recommend creating a solution dependency between the "dependency" solution and the solution that contains the dependent feature. Unfortunately that wasn't available in SP2007, so you may have to do something in your deployment script to achieve the same effect.

I realise this may mean deploying the solution before it is actually needed, but I think this is a small price to pay. If you don't do this there is a good chance that when you attempt to activate the feature it won't work.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top