Copied to clipboard

Flag this post as spam?

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


  • Gordon Saxby 1461 posts 1883 karma points
    Dec 01, 2010 @ 09:37
    Gordon Saxby
    0

    Create a package using C#

    Is it possible to create an Umbraco Package using C# rather than using the package builder within Umbraco?

    This would be for Umbraco 4.5.2 using SQL Server.

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Dec 01, 2010 @ 09:54
    Hendy Racher
    1

    Hi Gordon,

    You can do it as part of your build process, here's a blog post on Automating Umbraco Package Creation using MS Build.

    HTH,

    Hendy

  • Gordon Saxby 1461 posts 1883 karma points
    Dec 01, 2010 @ 10:32
    Gordon Saxby
    0

    Hi Hendy, what I am trying to do is automate the package creation from within Umbraco itself rather than a VS project.

    I will take a look at the above link but I was kind of hoping that I could tap into the inbuilt Umbraco package creator...

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Dec 01, 2010 @ 11:18
    Lee Kelleher
    0

    Hi Gordon,

    It definitely can be done programmatically, (as that's how Umbraco itself does it).  I haven't tried it myself, but took a quick look at the API - it looks like you'll need to use the "umbraco.cms.businesslogic.packager.CreatedPackage" class.

    Create a new instance of the "CreatedPackage" object, the Data property is a "PackageInstance" - there you can set all the files, macros, etc.  Then calling the "Publish()" method should create the zip file.

    Let us know how you get on.

    Cheers, Lee.

  • Gordon Saxby 1461 posts 1883 karma points
    Dec 01, 2010 @ 16:31
    Gordon Saxby
    0

    So far, so good - but I want / need to add an entry to createdPackages.config so that the created package appears in the Umbraco admin. However, I cannot (yet) see how to do it.

    I'm assuming it's not a manual process!! Anyone have any ideas?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Dec 01, 2010 @ 16:43
    Lee Kelleher
    0

    Hi Gordon,

    I believe that "umbraco.cms.businesslogic.packager.CreatedPackage.MakeNew(string name)" will create an entry in the "createdPackages.config" file.

    Not sure how familiar you are with the Umbraco core - might be worth spending a little time looking over the APIs in Reflector (or getting the source from CodePlex)? Its definitely possible to do what you want programmatically - as that's what Umbraco itself is doing when creating/installing packages.

    Best of luck, Lee.

  • Gordon Saxby 1461 posts 1883 karma points
    Dec 01, 2010 @ 18:55
    Gordon Saxby
    0

    Yes, I had seen "MakeNew" in the Umbraco source but it didn't appear with Intellisense!

    Just tried it and it added it to the Umbraco UI but didn't fill in the other fields - more investigation needed then :-)

  • Gordon Saxby 1461 posts 1883 karma points
    Dec 02, 2010 @ 11:18
    Gordon Saxby
    0

    OK, I have a basic creation working - for the selected node and its children, including the node template and document type.

    What I need to include now is any related stylesheets, macros, dictionary items and data types - oh yes and images!!?

    Any ideas?

     

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 27, 2011 @ 11:33
    Ghyselings Felicien
    0

    Hi gordon, can you explain me in outline how did you do  to have a basic creation working ?  

    Thanks

  • Naveen 1 post 21 karma points
    Jan 27, 2011 @ 14:27
    Naveen
    0

    How I can Add my course in to Umbraco?

Please Sign in or register to post replies

Write your reply to:

Draft