2

My Umbraco plugin adds a tab to the Developer section of Umbraco 7 back-office and I need to remove this tab on the uninstall of the associated nuget package.

Anyone has an idea of how this can be done ?

PS.: For installation as a local package I have an Application Event Handler that does the adding and removing of this tab, as you can see from the code below:

    /// <summary>
    /// Applications the started.
    /// </summary>
    /// <param name="umbracoApplication">The umbraco application.</param>
    /// <param name="applicationContext">The application context.</param>
    protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
    {
        // Install
        DashboardHelper.EnsureTab("StartupDeveloperDashboardSection", "CleanUp Manager", "/App_Plugins/RB.Umbraco.CleanUpManager/Index.html");

        // Uninstall
        InstalledPackage.BeforeDelete += delegate
        {
            DashboardHelper.RemoveTab("StartupDeveloperDashboardSection", "CleanUp Manager");
        };
    }

Bu I need to do the same when uninstalling it via nuget. Any Ideas ?

Thanks in advance for your help.

EdsonF
  • 2,719
  • 3
  • 30
  • 34

1 Answers1

1

Setup an Uninstall.ps1 script to do the removal for you when the package is uninstalled.

Nuget Documentation reference is here:

http://docs.nuget.org/Create/Creating-and-Publishing-a-Package#automatically-running-powershell-scripts-during-package-installation-and-removal

There are caveats though - if the Nuget package is referenced by project.json then the script won't be run.

Robert Foster
  • 2,317
  • 18
  • 28