0

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.

  • 1
    Do you have the List Definition and List Instance in 2 seperate features? – user2536 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
1

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.

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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