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 created an empty Project and used the default Feature1 thats created with the project to then create the following:

    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        AddProjectList apl = new AddProjectList();
        apl.createWebSite(properties);
    }

All this does is creates a website called Example.

Now the issue here, is that if I place this code in Feature1.EventReciever.cs and run the application not only does the event feature NOT appear in Manage Features but it also does not run the code, thus the site is never created.

How ever if I create a new Feature, Feature2 and place the code in feature2.EvenetReciever.cs and run the code again, the site is created and the feature shows up in Manage Features.

Why? Why can I not use Feature1 for all this?

Score For the Feature

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
</Feature>

This XML is in BOTH Feature1 and Feature2. how ever only Feature 2 Shows up for activation or deactivation while Feature One has all the Webparts associated with the solution.

share|improve this question
    
What's the scope of the feature? Could you post the feature.xml for this receiver? –  NotVonKaiser Jun 6 '13 at 15:04
    
@JohnCraven updated –  TheWebs Jun 6 '13 at 15:08
    
Hmm. Scope is a required field for the feature.xml file, and in fact VS will add this attribute automatically the first time you open up the feature page (where you specify which modules belong in your feature). Can you maybe try to add that, or else open the Feature1 provisioning page? –  NotVonKaiser Jun 6 '13 at 15:12
1  
It it's scoped to site there would be an attribute in that xml file that says Scope="Site". –  NotVonKaiser Jun 6 '13 at 15:25
1  
If Scope is set to Site, then the Feature would only show in Manage Site Collection Features, not Manage Site Features. –  James Love Jun 6 '13 at 21:55
show 2 more comments

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.