Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Aug 09, 2019 @ 05:42
    Tom
    1

    MORTEN!! - Umbraco 8 - Console App - CoreBootManager - UmbracoApplicationBase

    Hi all! (Especially Morten who wrote one of the first examples of a console app with Umbraco for v6 and v7)

    We wrote a console app which runs fluent migrator to migrate content, doc types properties etc for umbraco in v7 I'm porting it to v8 and would appreciate some help on understanding what has replaced corebootmanager and kicking the app off.

    This is the v7 code and in particular working out how to boostrap the console app

    /// <summary>
    /// Extends the CoreBootManager for use in this Console app.
    /// </summary>
    public class ConsoleBootManager : CoreBootManager
    {
        public ConsoleBootManager(UmbracoApplicationBase umbracoApplication, string baseDirectory)
            : base(umbracoApplication)
        {
            //This is only here to ensure references to the assemblies needed for the DataTypesResolver
            //otherwise they won't be loaded into the AppDomain.
    

    // Migration originally targeted a previous version of Umbraco so obosolete var interfacesAssemblyName = typeof(IDataType).Assembly.FullName; // Type or member is obsolete var editorControlsAssemblyName = typeof(uploadField).Assembly.FullName;

            base.InitializeApplicationRootPath(baseDirectory);
        }
    
        /// <summary>
        /// Can be used to initialize our own Application Events
        /// </summary>
        protected override void InitializeApplicationEventsResolver()
        {
            base.InitializeApplicationEventsResolver();
        }
    
        /// <summary>
        /// Can be used to add custom resolvers or overwrite existing resolvers once they are made public
        /// </summary>
        protected override void InitializeResolvers()
        {
            base.InitializeResolvers();
        }
    }
    
  • Shimi 2 posts 22 karma points
    Sep 19, 2019 @ 10:13
    Shimi
    0

    Hi, I am trying to create console application with umbraco 8. until now i don't understand how to do this.

    please some help :)

    thanks

  • Falco P. 2 posts 74 karma points
    Oct 09, 2019 @ 08:06
    Falco P.
    0

    As far as I researched creating a console application to do some one-time data processing does not work anymore. Or there is no documentation for it available yet.

    Instead I've used the following to hook into Umbraco V8 Web application to execute my migration code including access to the Umbraco API:

    Umbraco Documentation about Composing & Registering Components

    Here is my example code for importing some Wordpress posts by using the above concept:

    using Umbraco.Core.Composing;
    
    
    /// <summary>
    /// Registeres component in Umbraco automatically
    /// Starts import of some WordPress posts
    /// </summary>
    public class MyComposer : ComponentComposer<MyComponent>
    {
    }
    
    public class MyComponent : IComponent
    {
        // Initialize: runs once when Umbraco starts
        public void Initialize()
        {
            var contentService = Current.Services.ContentService;
            var logger = Current.Logger;
            var sqlContext = Current.SqlContext;
            var contentGridConverter = new ContentGridConverter();
            var wordpressArticleWpContentReplacer = new WordpressArticleWpContentReplacer();
            var myImporter = new myImporter(contentService, logger, contentGridConverter, wordpressArticleWpContentReplacer, sqlContext);
            myImporter.Import();
        }
    
        // Terminate: runs once when Umbraco stops
        public void Terminate()
        {
        }
    }
    
  • Pagggy 28 posts 71 karma points
    May 05, 2020 @ 16:11
    Pagggy
    0

    I am also looking for umbraco 8 console application. CoreBootManager has gone from umbraco 8 to initialise application.

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    May 06, 2020 @ 14:46
    Ismail Mayat
    0

    IN v8 use https://github.com/callumbwhyte/sidecar I have used it see

    https://github.com/callumbwhyte/sidecar/blob/master/src/Sidecar.ConsoleApp/Program.cs

    you can see how everything is wired up then you can get services. Note this is only for umbraco services you cannot do anything with IPublishedContent etc but if you want to create content / media then this works fine.

  • Gregory Pilar 1 post 21 karma points
    May 25, 2020 @ 13:40
    Gregory Pilar
    0

    @Ismail how are you using https://github.com/callumbwhyte/sidecar ?? I try it but Im getting the no factory error

  • elliot wyma 3 posts 72 karma points
    Jun 01, 2020 @ 14:04
    elliot wyma
    0

    I am also trying to create console application with umbraco 8. watched many youtube video but not getting what to do

    if you have any solution please help me

Please Sign in or register to post replies

Write your reply to:

Draft