Ejemplo n.º 1
0
        /// <summary>
        /// Builds the required services and an <see cref="ICakeHost" /> using the specified options.
        /// </summary>
        /// <returns>The built <see cref="ICakeHost" />.</returns>
        public ICakeHost Build()
        {
            try
            {
                // Create the "base" container with the minimum
                // stuff registered to run Cake at all.
                var registrar = new CakeServices();
                registrar.RegisterModule(new CoreModule());
                registrar.RegisterModule(new Module());
                var container = registrar.Build();

                // Add custom registrations to the container.
                container.Update(_registrations);

                // Find and register tasks with the container.
                RegisterTasks(container);

                // Resolve the application and run it.
                return(container.Resolve <ICakeHost>());
            }
            catch (Exception exception)
            {
                return(new ErrorCakeHost(exception));
            }
        }