Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Dingley 1470 posts 3427 karma points c-trib
    Aug 13, 2009 @ 23:09
    Simon Dingley
    0

    Package Action ExecuteSql on Uninstall not working

    Can anyone see any reason why the following pacakge action would not work?

    <Action runat="uninstall" undo="false" alias="ExecuteSql"><![CDATA[UPDATE umbracoAppTree SET treeHandlerAssembly = 'umbraco', treeHandlerType='loadMedia' WHERE treeAlias='media']]></Action>

    I have an install action that is almost identical and works fine, I am simply trying to return the AppTree to its state before it was altered.

    Umbraco 4.0.2

    Any ideas? TIA

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 13, 2009 @ 23:17
    Dirk De Grave
    0

    Did the package action make it into the xml for the installed package? Can be verified in the installedPackages folder (I'm thinking the action should be in the xml, otherwise it won't be fired)

     

    /Dirk

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Aug 14, 2009 @ 07:47
    Simon Dingley
    0

    Yes it is in the package XML, all present and correct, so I am still stumped. I also ran the actions through the Package Actions Tester with success.

    On a seperate note, something else I have just discovered is that the zip files created by the Package Manager do not allow the files to extracted using Windows Explorer for some reason, in XP SP3 anyhow. I had to use another app for extracting the file to take a look.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 14, 2009 @ 07:54
    Dirk De Grave
    0

    Luckily, I have a similar install (i'm also doing the media trick - but don't include the uninstall action - which i will now) and i'll run a quick test on my local box.

     

    Keep you updated!

    Cheers,

    /Dirk

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Aug 14, 2009 @ 08:00
    Simon Dingley
    0

    Thanks Dirk, look forward to hearing your findings.

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Aug 14, 2009 @ 08:03
    Richard Soeteman
    0

    Hi Simon,

    try to remove the undo="false" attribute. If that doesn't help you try to attach a debugger when uninstalling. What could have happened is that the dll is removed before the action is executed.

    If that is the case it's a bug in the core. Then I reccommend to create a custom action for your needs and add the code above to the Undo method. Also make sure that you still remove the undo="false" attribute Otherwise the undo will never be hit.

    Hope it helps you,

    Richard

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 14, 2009 @ 08:30
    Dirk De Grave
    0

    it could be the case Richard, when uninstall actions are being fired (there in the config for uninstalling), the action is checked against a list of the 'standard' package actions, where we'd expect the custom package action to be in the list as well!

    Furthermore, the class has a static constructor that fires to find all actions that implement IPackageAction, so will only fire once. I'm not sure whether that static constructor fires again if you add a new dll (does that initiate a restart?)

    @Simon ,did you include the package action contrib in the package (as a file), or was it already in the /bin folder before the install/uninstall. It would be great test if you could try that one (= PackageActionsContrib.dll in /bin folder, iis reset, and install/uninstall - do not include dll in package then)

     

    If it still doesn't work, we need to create a new work item on Codeplex to change behaviour of the static constructir

     

    Let us know what you can find.

     

    Cheers,

    /Dirk

     

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Aug 14, 2009 @ 09:48
    Simon Dingley
    0

    I tried your suggestion Richard but to no avail!

    I suppose I will need to go down the route of a custom package action to perform this task for the time being then.

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Aug 14, 2009 @ 09:50
    Simon Dingley
    0

    Dirk, no I didn't have the PackageActionContrib.dll in my package, it was already in the installation. I have just a single dll in my package.

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Aug 14, 2009 @ 09:55
    Richard Soeteman
    1

    I think a custom package action is the best option then. Again make sure undo="false" is not in the xml. For some reason it fails

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Aug 15, 2009 @ 17:27
    Simon Dingley
    0

    Even having created my own custom package action it does not seem to run when the package is uninstalled and I have not included my package action in the package yet I have just dropped it into the bin folder for the site. Has anyone ever successfully ran an uninstall action?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 15, 2009 @ 21:31
    Dirk De Grave
    100

    Yes Simon, I've done that before succesfully, so it should be possible. Been debugging some more and have found following:

    1. PackageActionsContrib assembly not included in package, but available in /bin folder:

    actions that have runat="uninstall' or for which undo="false" (yes, that's a bug... reported on Codeplex - or undo ommited) will be included in list of actions to uninstall. ExecuteSql cannot be used in uninstall process as the undo action is not supported (it's supported, but returns false upon hit). Even if you specify ExecuteSql to run on uninstall (and expect the action to fire), it will fire the undo action on uninstall (which just returns false and does nothing)

    2. PackageActionsContib assembly included in package, not in /bin folder.

    install actions will run fine, uninstall actions (custom package actions) won't be hit as assembly gets deleted before custom package action can be executed, so nothing gets executed. (Culprit here is a static constructor that gets hit again whenever the first uninstall action is called)

    Bottom line: I think you're doing the right job in creating a custom action (undo='false' to make sure it gets to the list of actions to uninstall, and code should be in undo method), build the assembly, drop in /bin folder and install/uninstall the package. I wonder why this does not work in your case. Ran out of ideas now!

     

    Cheers,

    /Dirk

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Aug 16, 2009 @ 12:15
    Simon Dingley
    0

    Hi Dirk,

    I have omitted the under="false" and not put my code in the undo method so will give that a go, my misunderstanding of what was required!

    Its a shame that the Package Action can't be included in the package as I now have to offer instructions and seperate download for anyone that will want my package when I publish it. Hopefully this can be resolved at some point in the future.

    I will report back on my success when time allows today as I am keen to get this out and off my desk.

    Cheers, Simon

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Aug 16, 2009 @ 12:40
    Simon Dingley
    0

    Success! Thanks for your time and effort on this Dirk/Richard.

    It feels like a bit of a hack but at least a working solution for now. Hopefully when I have some time later I can tidy this all up and publish it at long last :)

  • Sa 118 posts 152 karma points
    Nov 06, 2009 @ 10:38
    Sa
    0

    does uninstall in the package works?

    when uninstaling the package, the database entry to the specific table  should be removed.. any clue?

    Thank you

  • Sa 118 posts 152 karma points
    Nov 09, 2009 @ 07:02
    Sa
    0

    i got uninstall worked for database entry.. but its not working for dashboard entry

Please Sign in or register to post replies

Write your reply to:

Draft