1

I have a WinForms project that acts as a Sharepoint 2013 Solution installer. It basically do some checking, create a sql database, adds and install a SP Solution and finally activates the feature.

The feature is scoped to "Site Collection" and the code to activate it is the following:

SPFeature feature = siteCollection.Features.Add(featureId.Value, true);

In some environments this works well. But in others this throws the following exception:

Feature with Id 'guid' is not installed in this farm, and cannot be added to this scope.

I've searched this exception and found some solutions that doesn't apply to my case.

Any ideas?

4
  • Can you give some details about the farm topology? Is this a multi server farm? If so do all servers have the web application role activated? Are you able to activate the features using powershell (Enable-SPFeature) on the same box? Sep 23, 2013 at 10:24
  • I'm testing this installer in Cloudshare environments, which are just one VPS with SP2013 and everything needed to run it. Yes, I can manually enable the feature via the site and also via powershell.
    – empz
    Sep 24, 2013 at 15:37
  • Is your your windows app compiled for windows x64? Sep 26, 2013 at 4:09
  • @MarcoScheel Yes, yes it is.
    – empz
    Sep 26, 2013 at 17:57

2 Answers 2

4
+25

make sure the solution deployment job was finished before you activate the feature.

have a look at this blog: Programmatically waiting on SharePoint Solutions to deploy

2
  • The installer is based on this project: sharepointinstaller.codeplex.com which already has a step that waits for the deployment job to be finished before trying to activate the feature.
    – empz
    Sep 22, 2013 at 16:43
  • Have a look at the solution deploy status when you get the exception?
    – Eric
    Sep 23, 2013 at 1:59
1

Check to ensure the feature is actually installed on the farm. You can look in the 15 HIVE for the feature folder. In addition, you can look at the Get-SPFeature PowerShell Cmdlet output to see if it gets listed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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