I’ve also added in some additional error handling so we get informative messages if the metadata service and/or term set does not exist.
Note that if we are only creating a site column (or even a content type) this should work without completing the following steps.
To add these to our custom list definition we use an element file similar to the one below (note the List Template Id should match the Type attribute of our list definition).
As a final step we can optionally create a list instance so that when we deploy our solution lists are created automatically.
section to the field and hardcode the various Id’s that define a term set (required if you are using a sandboxed solution), or configure these in code.
I’m taking the code approach here as it is the only way to ensure the field will work across multiple environments.
I find the easiest way to ensure all the columns are added to the list definition is to add them to a content type first.
This content type should contain the managed metadata/taxonomy field, the note field and the Tax Catch All and Tax Catch All Label fields as shown below.
Sidenote: you want to remove the /Lists/ prefix from the URL when creating document libraries to avoid breaking the default column values feature.
You will also want to add in the file dialog view as it goes missing when using the Visual Studio 2010 tools.
This should be done as a separate web scoped feature.