I have created a custom list definition with my custom fields

Now I want to deploy my feature in farm level i.e

1 When I deploy my solution in central admin as a farm solution that particular list definition should be available for all the web applications and the site collections available and also for newly created ones.

2 I tried changing the scope of the default feature of list defintion to farm but I am encountering with a problem like "the list instance and list definition cannot be deployed at farm scope"

Note: I deployed the solution in web level and it works fine but for farm,site and webapp it throws me and error that it cannot deploy.

It is very important for me and please anyone help me with this... I would pleased if you can provide me the solution ASAP

Thanks in Advance


If I have understood your question, you have two problem:

  • activate your feature on all currently existing webs.
  • automagically activate the feature on every new web that will be created from this point onward.

For the first problem, you best bet would be using a PowerShell script to automate the activation process. For example:

Get-SPWebApplication “<WebApplicationURL>” | Get-SPSite -Limit ALL |
   ForEach-Object {Enable-SPFeature “MyFeatureID” -Url $_.Url -confirm:$false}’

This would activate a feature on all site collection in a web application. You could edit it to cycle on all web sites for each site collection for each web app.

You second problem requires that the feature gets activated by default on each new web site that you will create in the future. This can be resolved by using feature stapling. The feature stapling infrastructure enables you to attach a feature to an existing site/web definition so that when a new site/web is created the stappled feature will be activated. Note that this will work only for new sites (ie: the stapling is not retroactive). This link to another question should explain stapling in further detail.

Would a similar solution be viable for you?

  • I have created my custom list definition through VS2010
    – kart
    May 30 '12 at 12:19
  • Hello @SPArchaeologist thanks for the reply but I have created my custom list definition using Visual Studio 2010. How can I use the Powershell command for that... I have deployed my solution through visual studio.. If it is regarding the visual studio i have deployed my solution in web and site scope's it works fine but when I deploy through Farm and Web Application scope it is throwing me and error.. Any help regarding this is deeply appreciated..
    – kart
    May 31 '12 at 6:23
  • 1
    The problem is just that. You won't be able to scope a feature that provision a list definition at a webapp/farm level, so what I suggested was to solve your problem in another way -forcing your feature to be activate on each site/web in the farm. As I said this would require two step: 1- ensure that the feature will be activated on every site/web that already exist 2- ensure that the feature will be automatically activated for any new site/web created in the future. In my answer I was suggesting how I would solve this two problem. Please let me know if there is anything you don't understand
    – SPArcheon
    May 31 '12 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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