예제 #1
0
        /// <summary>
        /// </summary>
        public override void Execute()
        {
            // Call base execute to ensure that base functionality is called if there are any.
            base.Execute();

            if (!String.IsNullOrEmpty(this.Name))
            {
                IIServerManager.RecycleApplicationPool(this.Name);
            }

            if (this.AllPools == true)
            {
                IIServerManager.RecycleApplicationPools();
            }

            if (this.OwsTimer == true)
            {
                WindowsServices.Restart(WindowsServices.Current.SPTimerName);
            }

            if (this.AdmTimer == true)
            {
                WindowsServices.Restart(WindowsServices.Current.SPAdminName);
            }

            if (this.All == true || NothingSpecified())
            {
                IIServerManager.RecycleApplicationPools();
                WindowsServices.Restart(WindowsServices.Current.SPTimerName);
                WindowsServices.Restart(WindowsServices.Current.SPAdminName);
            }
        }
예제 #2
0
        /// <summary>
        /// Will copy assemblies to the Global Assembly Cache.
        /// First recycle the Application Pool
        /// Then try to install the assemblies into GAC
        /// </summary>
        public override void Execute()
        {
            // Call base execute to ensure that base functionality is called if there are any.
            base.Execute();

            // First recycle all Application pools
            IIServerManager.RecycleApplicationPools();

            // Should the owstimer service be recycled?
            // Should the Admin service be recycled?

            // Copy to Global Assembly Cache.
            // Install the assembly into the GAC with force
            // --------------------------------------------
            int assembliesInstalled = 0;
            int failedInstallations = 0;

            string[] assemblyPaths = GetAssemblyPaths(this.Dir);

            foreach (string path in assemblyPaths)
            {
                if (IsAssemblyToBeInstalled(path))
                {
                    if (InstallAssembly(path))
                    {
                        // Success
                        assembliesInstalled++;
                    }
                    else
                    {
                        failedInstallations++;
                    }
                }
                else
                {
                    // Ignore assemblies that are not to be installed
                }
            }

            if (failedInstallations > 0)
            {
                Log.Error("Error copying to Global Assembly Cache!");
            }
            else
            {
                if (assembliesInstalled > 0)
                {
                    Log.Information("Done copy to Global Assembly Cache!");
                }
                else
                {
                    Log.Information("No assemblies found!");
                }
            }
        }