Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.

 

How to call Uninitialize method in IInitializableModule module used in Episerver Module creation

Vote:
 

Hi ,

When i am trying to un-install my module from Visual Studio Manage Nuget Package Manager, my Uninitialize method in one InitializableModule is not getting triggered. What is the best way to trigger a Uninitialize method in IInitializableModule module used in Episerver Module.

[InitializableModule]
[ModuleDependency(typeof(DataInitialization))]
[ModuleDependency(typeof(ShellInitialization))]
public class TInitializer : IInitializableModule

This is how my declaration for the module, but this is not getting called when i am uninstalling my module from nuget package manager in visual stuido. I have some scripts to run when i am trying to uninstall this module.

Regards,

Manik

#219151
Mar 30, 2020 10:14
Vote:
 

Uninitialize is for the application, i.e. when your website or application shuts down. If you are thinking about uninstall nuget package, then it can be done via uninstall.ps1  http://www.roundcrisis.com/2014/08/03/Nuget-install-tricks/

#219153
Mar 30, 2020 11:10
V M S MANIKYALA RAO - Mar 30, 2020 11:51
So when i am uninstalling my nuget package (which is a Episerver Module) , i need to trigger the powershell script to run my code which should be done at uninstallation?
Quan Mai - Mar 30, 2020 11:57
mostly yes. you need to write a uninstall.ps1 and put it in your nuget package. When your package is uninstalled, nuget will execute your uninstall.ps1 automatically
valdis - Apr 01, 2020 19:44
You can checkout some Episerver packages that does this already . If I recall correctly Episerver.Framework has some PS scripts to execute at various package installation stages..
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.