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 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?

share|improve this question
    
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? –  Marco Scheel Sep 23 '13 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. –  emzero Sep 24 '13 at 15:37
    
Is your your windows app compiled for windows x64? –  Marco Scheel Sep 26 '13 at 4:09
    
@MarcoScheel Yes, yes it is. –  emzero Sep 26 '13 at 17:57
add comment

2 Answers

up vote 2 down vote accepted
+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

share|improve this answer
    
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. –  emzero Sep 22 '13 at 16:43
    
Have a look at the solution deploy status when you get the exception? –  Eric Sep 23 '13 at 1:59
add comment

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.

share|improve this answer
add comment

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.