Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I created a custom list definition, which works well. When i deploy, the list definition is added, when i retract, the list definition retracts properly.

I also created a list instance from said list definition. When i deploy, the list is added and 3 items are created as directed in the element.xml .

The problem is that when i retract my solution, the list instance is still there, although inaccessible (some kind of native stack crash), each time i redeploy the instance of the list, it recreates 3 more items, so i end up with multiple items instead of just 3.

Something is also very weird. I tried to create a feature inside my project to deploy the said list and the said list definition but it wont work. It gives me a compile time error saying something like "I cant activate that feature, try again".

What's actually weird is that i can deploy it if i add it to another feature that was already inside the project. I checked for the properties and they are exactly the same for both features.

share|improve this question
1  
Do you have the List Definition and List Instance in 2 seperate features? –  Daniel Ziga Feb 24 '12 at 21:17
    
I try separating them and it works i can deploy just fine but i still have that issue where it populates items again and again, also does not retract properly. –  Dr.Denis McCracleJizz Feb 24 '12 at 21:31
add comment

1 Answer

up vote 1 down vote accepted

Once I had this problem and my workaround was to create an FeatureEventReceiver for creating the listitems. There you also can delete the list on feature deactivation and the retract leaves no problems.

share|improve this answer
    
Thanks i'll try it out. –  Dr.Denis McCracleJizz Feb 27 '12 at 14:44
    
Still having problems. The SPContext.Current inside the event listener is returning null. Any ideas how i could fix this ? –  Dr.Denis McCracleJizz Feb 27 '12 at 15:59
    
SPSite site = (SPSite)properties.Feature.Parent; –  Dr.Denis McCracleJizz Feb 27 '12 at 16:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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