Copied to clipboard

Flag this post as spam?

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


  • Jonathan Cohen 40 posts 115 karma points
    Oct 08, 2010 @ 21:27
    Jonathan Cohen
    0

    Macro Property in Package do not install

    Hi,

    I have made a simple package, it installs fine, but in one macro i have made my own macro property that also works fine but I can not get it to install the macro properties.

    In the package XML the line adding the property looks like this:

     <property name="Color Scheme" alias="ColorScheme" show="True" propertyType="puginValueTypePicker" />

    And in the Actions i do a DB install:

    <Action runat="install" undo="false" alias="ExecuteSql">
        <![CDATA[
        if not exists(select * from  cmsMacroPropertyType where  macroPropertyTypeAlias = 'pluginValueTypePicker') begin
            insert into cmsMacroPropertyType (  macroPropertyTypeAlias, macroPropertyTypeRenderAssembly, macroPropertyTypeRenderType, macroPropertyTypeBaseType )
            values ( 'pluginValueTypePicker', 'NWS.FacebookSocialPlugins', 'Macro.PluginValueTypePicker', 'String')
        end
        ]]>
    </Action>

    An error i the log says:

    Error creating macro property: System.ArgumentException: No macro property type found with the id specified     
    at umbraco.cms.businesslogic.macro.MacroPropertyType.setup()    
    at umbraco.cms.businesslogic.macro.MacroPropertyType..ctor(String Alias)    
    at umbraco.cms.businesslogic.macro.Macro.Import(XmlNode n)

    The other "standard" macro properties installs fine.

    Any help on this I could get would be greit, also how should I handle:

    1. MySql Datasource?

    2. Uninstall don't seem to work on the DB

     

    /Jonathan

  • Sebastiaan Janssen 4840 posts 14343 karma points MVP admin hq
    Oct 09, 2010 @ 16:26
    Sebastiaan Janssen
    0

    There is a typo in either the property or your SQL script, the property says puginValueTypePicker and the script has the (presumably correct) spelling with the "l" in it (pluginValueTypePicker).

  • Jonathan Cohen 40 posts 115 karma points
    Oct 10, 2010 @ 08:21
    Jonathan Cohen
    0

    Hi Sebastiaan,

    Thanx for pointing on the spelling mistake (does this make me feel stupid).

    I have now corrected this, but it still do not work (at least not on a first install).

    What happens if I look in the log is the following:
    - First a get an error creating the property (like in my first post)
    - Then the actions run correct.

    If I uninstall the package and then install again it works fine (or if a manually insert into the DB first).
    For me this indicates that the error I get is correct, cause the insert in the DB happens after the Macro is created.

    Can anyone confirm how the order in a package.xml works, and if you are able to tell the code something like "pre" and "post" actions.

    I have been looking into the Package Actions Contrib and made a little "AddMacroProperty" action that works both with install and uninstall, I will test it a bit more and then send it for review.

    /Jonathan

     

  • Sebastiaan Janssen 4840 posts 14343 karma points MVP admin hq
    Oct 10, 2010 @ 08:49
    Sebastiaan Janssen
    0

    Hehe, been there, done that. At some point you just start overlooking things if you're in too deep. That's when an extra pair of eyes really helps.

    I am not of the order in which the package actions will be executed, but it sounds like it works on a clean install right? After you uninstall it works. But maybe during uninstall, the pluginValueTypePicker is not removed from the cmsMacroPropertyType table, so check that out first, but it sounds like you're good to go, right?

  • Jonathan Cohen 40 posts 115 karma points
    Oct 10, 2010 @ 09:38
    Jonathan Cohen
    0

    Hi again,

    It is actaully the other way round it do NOT work on a clean install, because of the order it seems to be executing.

    If I uninstall (makeing sure the pluginValueTypePicker is in the cmsMacroPropertyType table, with a undo=false) or do a manuall insert into the table It works because then the ID exist.

    The workaround here is to:

    1. Install the Package (with undo=false) - fails creating the propertys, but success with inserting into the table
    2. Uninistall the Package - do not delete from table
    3. Install the Package - now it works because the right things exists in table.

    OR

    1. Do a manuall insert into the table
    2. Install the Package - now it works because the right things exists in table.

    None of these solutions is good enoght when I want to let people easy install my package, there must be tons of packages out there with Custom Macro Properties working, how?

    /Jonathan

  • Sebastiaan Janssen 4840 posts 14343 karma points MVP admin hq
    Oct 10, 2010 @ 09:48
    Sebastiaan Janssen
    0

    I wouldn't be so sure of that! ;-)

    In blog4umbraco, I know that some database stuff is being done after the install, you could have a look at the blog posts about that and the source code.

  • Jonathan Cohen 40 posts 115 karma points
    Oct 10, 2010 @ 10:28
    Jonathan Cohen
    0

    Aha, you mean a usercontrol based Installer?

    Yes, that is right - they do DB stuff after install, I want to do it befor :-)

    But i could try it this way and do my DB stuff in an ascx and then registrating the maco efter that, it should work.

    But I realy would like to use the easy Package Actions.

     

     

  • Jonathan Cohen 40 posts 115 karma points
    Oct 10, 2010 @ 21:40
    Jonathan Cohen
    0

    Okey,

    I have now solved this making a second package action running after the AddMacroProperty action, findnig and updateing rows in DB.
    Thanks Sebastiaan for sharing your thoughts.

    Still i am intressting in how other people solved this issue?

    /Jontahan

  • Sebastiaan Janssen 4840 posts 14343 karma points MVP admin hq
    Oct 10, 2010 @ 22:15
    Sebastiaan Janssen
    0

    No problem, I've invited people to have a look at this, hopefully someone can provide an alternative!

  • Matt Brailsford 2242 posts 10933 karma points MVP 6x c-trib
    Oct 10, 2010 @ 22:24
    Matt Brailsford
    0

    Hi

    I belive package actions are the last thing to run when installing a package, so that'll be why it's failing, because at the time of installing the Macro, the package action to install the property type hasn't yet run.

    If you solution works, I'd probably just go with it (I have a fair few quirky workarounds in some of my packages).

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft