Steps to creating a new list with custom views and a custom content type:
Why use a custom content type?
- Create your site columns (fields) and content type, and deploy it to your development farm.
- Create a new generic Custom list on any site of your choosing. Enable content type management on the list.
- Remove the default Item content type from the list.
- Add your new custom content type to the list, it should be the default.
- Customize your views as needed.
- Use the SharePoint Solution Generator to generate a List Definition for your new list. The resulting generated Visual Studio project will contain a folder for the list that contains several form files (DispForm.aspx, EditForm.aspx, and NewForm.aspx) and an .aspx file for each view you created such as AllItems.aspx. You will also have a schema.xml file which contains the content type definition, the views definition, and the fields section. Leave the Fields and Views nodes/sections alone as they contain the definitions you defined.
- In the schema.xml file, in the ContentTypes node you will find a ContentType node defining your custom content type. Comment (or delete) this entire node. We will add this content type to the list via code instead of defining its association here declaratively.
The Major Task content type is commented out here because we are going to add
it programmatically via the ListInstances feature receiver. This allows us to
properly promote all the fields in the content type to the list and enable
content type management on the list much more easily.