I have a question, basically in a solution i have 2 packages which should be independent, but also should work properly together. So I have a feature which basically is required in both packages.

I would like to have same feature in both packages. The idea is when one of the package is intalled i can activate that feature, lets say the name is Single Feature, but when both packages are intalled i should also only see one Single Feature. How should i do it?

So i created 2 exact same features with the same id and same name ... but i can't install the second package then.

Any idea to have 2 features but in the site collection features i will only see one of them?

1 Answer 1


You can use feature dependency if your SharePoint Feature may depend on other Features for functionality or data. In these cases, you can mark these other Features as dependencies for your Feature. This way, the SharePoint server ensures that dependent Features are activated before your Feature is activated.

So create three seperate packages and add the dependency between the features.

If you don't want to see the third feature, then you can hide this feature and ensure that the feature is activated when activating one of the other two features.

For example, code below can be use in a web scoped feature to ensure a site scoped feature is activated.

Guid featureGuid = new Guid(<Guid feature here>);
SPFeature feature = web.Site.Features[featureGuid];
if (feature == null)
  • No, you probably haven't read my question properly, I wan't to make 2 packages totally seperate, no dependencies are needed. So I need to have 2 exact same features in 2 packages, but if both packages are deployed only one of the features should be shown
    – Shkipper
    Dec 17, 2013 at 9:23
  • Could you give me an example why you want this, because I do not understand why? If you have 2 packages you have 2 different kind of funcionality and If they share functionality you can create a third package with a hidden feature that can be activated.
    – Remko
    Dec 17, 2013 at 9:42
  • An example i have a script which i want to activate by feature, and in both packages, and i do not want to create a third package for that. So i have 2 packages with this script to activate, i do not want to see in site collection features, like script feature (first package-, script feature (second featre), but i would like to see only one instance of it, although both of the packages would be deployed
    – Shkipper
    Dec 17, 2013 at 12:43
  • You can create hidden features that can be activated by a visible one. If you dont want to depend on another solution I think its best to package the script in both packages.
    – Remko
    Dec 17, 2013 at 12:57
  • that is also what i'm doing, but i would like to have a seperate feature in both packages visible, but if both are installed then only one visible, one of them ... but i suppose it is not possible then
    – Shkipper
    Dec 17, 2013 at 13:02

Your Answer

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

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