public override bool Execute()
        {
            ParseAssembliesForPlugIns assemblyParser = new ParseAssembliesForPlugIns();
            IList<string> safeToIgnoreAssemblies =
                assemblyParser.GetSafeToIgnoreAssemblies(this.ConfigFile.GetMetadata("FullPath"));

            ParseEPiServerFrameworkConfig configParser = new ParseEPiServerFrameworkConfig();
            IList<string> excludedAssemblies = configParser.GetExcludedAssemblyList(this.ConfigFile.GetMetadata("FullPath"));

            //Generate warnings where an assembly isn't excluded but could be excluded
            foreach (string assembly in safeToIgnoreAssemblies)
            {
                if (!excludedAssemblies.Contains(assembly))
                {
                    this.Log.LogWarning(
                        "Assembly \"" + assembly
                        + "\" can be safely removed from being scanned by the EPiServer intialisation system. Consider adding a <remove assembly=\""
                        + assembly
                        + "\" /> to the <episerver.framework><scanAssembly> section in order to improve start up times.");
                }
            }

            //Generate errors where an assembly is excluded but contains init modules or plug ins
            foreach (string assembly in excludedAssemblies)
            {
                if (!safeToIgnoreAssemblies.Contains(assembly))
                {
                    this.Log.LogError(
                        "Assembly \"" + assembly
                        + "\" is excluded from scanning in the <episerver.framework><scanAssembly> section but contains an EPiServer plug in or initialisation module. Remove this exclusion to ensure all plug ins are loaded correctly.");
                }
            }

            return true;
        }
Ejemplo n.º 2
0
        private static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("No project web.config path specified.");
                Console.ReadKey();
                return;
            }

            string sourcePath = args[0];

            if (!File.Exists(sourcePath))
            {
                Console.WriteLine("Could not open file \"" + sourcePath + "\".");
                try
                {
                    Console.ReadKey();
                }
                catch
                {
                }
                return;
            }

            ParseAssembliesForPlugIns assemblyParser = new ParseAssembliesForPlugIns();

            StringBuilder sb = new StringBuilder();

            foreach (string assemblyName in assemblyParser.GetSafeToIgnoreAssemblies(sourcePath))
            {
                string remove = "<remove assembly=\"" + assemblyName + "\" />";
                Console.WriteLine(remove);
                sb.Append(remove + Environment.NewLine);
            }

            Clipboard.SetText(sb.ToString());

            Console.WriteLine();
            Console.WriteLine("========================================");
            Console.WriteLine("Remove assembly list copied to clipboard");
            Console.WriteLine("========================================");

            try
            {
                Console.ReadKey();
            }
            catch
            {
            }
        }