Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm creating a site definition which provisions a subsite based to a webtemplate(wsp) file. This webtemplate file is packed in a feature containing a module.When the feature is activated the wsp file is added to the solution gallery. Another feature, a provisioning handler then creates a subsites based on this template.

My Problem

  1. Just adding to the solution gallery does not activate the solution. Unless the added solution is activated it cannot to used as a template. How can I activate the solution through code?
  2. Alternatively we can add the solution to SPFarm.Solutions and then perform deploysolution. Is it a good idea to proceed this way?
  3. Is there any better approach to this requirement?

Any help would be greatly appreaciated.

share|improve this question

1 Answer 1

I would deploy wsp and activate it and handle only activation of desired features on specified web/site collection.

Activation of features can be done by website template where you can specify features to be activated.

I'm not saying this is the best approach but we use it on many projects. If there is any better solution I'd be glad to know something new and improve our deployment process.

share|improve this answer
    
When i use: SPUserSolutionCollection solutionsCollection = currentSite.Solutions; foreach (SPUserSolution solution in currentSite.Solutions) {string name = solution.Name; if (solution.Name.ToLower() == "mysolution.wsp") {mysolutionID = solution.SolutionId;}} I see currentSite.Solutions.count = 0. I tried both SPSite.solution and SPWeb.solution and end up with the same issue. What do you think I'm missing here? –  vivek sisodiya Feb 1 '13 at 6:51
    
I'm not sure but isn't this only user uploaded solutions? msdn.microsoft.com/en-us/library/… I never tried activating specific solutions, I'd rather go the way activating features. If you have to activate different solutions for different site coll., split them rather into more web apps –  luccio Feb 1 '13 at 8:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.