I have a WebApplication scoped feature and I am getting this error when I deploy. I have searched all over the internet, and the answers I have found are not much help. Here is the code that is breaking on me:

public override void FeatureInstalled(SPFeatureReceiverProperties properties)

     SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
     String ownerId = properties.Feature.DefinitionId.ToString();
     list<SPWebConfigModification> modsToAdd = new List<SPWebApplication>();

  //.....more code

I have the scope set right, but I am not sure what is going on here. I do have another feature that has a scope of Site. Can I have multiple features with different scopes?

  • Is Partent a typo in pasting or is that really in the code? Feb 25, 2015 at 18:24
  • That was a typo
    – lazoDev
    Feb 25, 2015 at 18:27
  • You want functionality on "FeatureInstalled" or "FeatureActivated"? Try adding code in "FeatureActivated" event.
    – 404
    Feb 25, 2015 at 18:50
  • well i think that was it. why would it not work in the install feature? It will still not deploy, but the error has changed to a location i am trying to add in the web.config
    – lazoDev
    Feb 25, 2015 at 19:34


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.