Having some issues with lists that are created with a list definition in Visual Studio 2010 RRS feed

  • Question

  • I created a list definition in Visual Studio 2010, based on a Content Type that was already defined in the same project.  When I tried to debug, the list was created on SharePoint 2010 just fine.  The issue was after I finished the debug, the list was not removed even though the site columns, content types and list definition were all removed.  The result is a link to the list that is left in the Quick Launch, that goes to an error page.  I thought the sandbox was supposed to protect against these kinds of issues.  In my case, the list was not retracted, even though everything else was retracted.  And, I was left with an orphaned list in my production site. 

    So, what did I do wrong?  I've been through the books and the MSDN site looking for similar experiences, and found nothing.  I did find three posts that describe how to create lists from Visual Studio 2010:

    - http://msdn.microsoft.com/en-us/library/ff728096.aspx

    - http://msdn.microsoft.com/en-us/library/ms466023.aspx

    - http://msdn.microsoft.com/en-us/library/gg276355.aspx

    In all of these cases, they say to change the "Type" attribute on the list definition XML - and I did that.  There is also a reference to setting DisallowContentTypes="FALSE" - I did not do this, but, I do not see how this could have caused the problem.

    So, what did I do wrong?



    Thursday, November 18, 2010 8:57 PM


  • The problem is several-fold.

    1) When you do an F5 debug/deploy .. after you finish debugging it will retract your solution and de-activate all of your features

    2) The "List Instance" feature will not delete the list when the feature is retracted!

    3) If your Solution (WSP) is retracted, then the schema files (e.g. schema.xml) are deleted, so your list doesn't work anymore.

    The main thing to offer is caution. Create your lists manually and make sure you delete them after you've finished testing.

    Also, check whether you REALLY need a List Instance feature anyway?? (the vast majority of lists are created through the user interface by end users, so by using a List Instance you are missing out on an element of user testing)

    Martin Hatch
    MCPD .Net Web Development
    MCTS WSS 3.0 | MOSS 2007
    Visit my Blog - www.martinhatch.com
    Friday, November 19, 2010 9:29 AM