I have a feature that deploys a site in a folder in the root of the parent site. When we want to uninstall this feature, the only way to remove the files it deploys is by programmaticaly remove them using the SPFolder.Delete()
method. I want to do this using an Event Receiver which I developed.
The problem is that when I try to uninstall the feature, the event receiver doesn't catch the Event and nothing happens.
This is the class and method where I do this:
public class Feature1EventReceiver : SPFeatureReceiver
{
public override void FeatureDeactivating(SPFeatureReceiverProperties properties){
//delete folders
}
}
I'm suspecting the reason the event receiver doesn't catch the event is because the event receiver is in a different project than the feature, so my question is which of these file structures should I use?
Solution
|
+ Webpart (project)
|
+ Features (folder)
|
+ Web part (feature)
+ EventReceiver (feature)
OR
Solution
|
+ Webpart (project)
|
+ Features (folder)
|
+ Web part (feature)
+ EventReceiver (project)
|
+ Features (folder)
|
+ EventReceiver (feature)
Let me know if you think the reason to fail in catching the event migt be other.
EDIT
I have previously tried @Evariste layout but I always get a "this sandboxed solution has exceeded its daily resource usage quota" error when I try to deploy although the Solution Gallery looks like this:
This is how my project structure looks when I get that error: