I found an odd issue using the Visual Studio 2010 Tools the other day. Only just gotten around to writing about this, as it’s been a hectic few weeks. Well it’s not odd, but it caused me a few head scratching moments until I realised what was going on. Here’s the scenario:
- I create a custom content type and add it to a feature.
- I create a list template based upon the custom content type using the VS2010 tools and add it to a feature.
- I create a list instance of the content type using the VS2010 tools and add it to a feature.
- When I run the feature to create the list instance I get one of those horrible <native> errors which refers to an incomprehensible or irrelevant error.
- However when I create a list instance through the UI from my List Template everything works fine…
It transpire it’s because when you do the steps this way there is something missing from the List Instance CAML. The feature ID. VS2010 doesn’t appear to figure out what Feature the List Template resides in when it creates the List Instance CAML.
So here’s how to avoid the error:
- Create a custom content type and add it to a feature.
- Create a list template based upon the custom content type using the VS2010 tools and add it to a feature.
- Deploy the List Template
- Create a list instance of the content type using the VS2010 tools referencing the deployed List Template and add it to a feature.
- Now everything works fine, because the List Instance CAML has the Feature Id in it.
Problem solved. Hope this helps!
Cheers
Dave Mc






Leave a comment