public void Build(Config config)
        {
            xmlExtensions = new List <string> {
                ".xml", ".config"
            };
            var configFiles = Directory.GetFiles(config.ConfigDirectory, "*.nuspec");

            foreach (var file in configFiles)
            {
                var packageName = Path.GetFileNameWithoutExtension(file);
                var pconfig     = new PackageConfig(config, packageName);

                // Create all the package directories we'll need
                pconfig.Ensure();

                // Move in the nuspec file
                string nuspecFile = Path.Combine(pconfig.PackageDirectory, Path.GetFileName(file));
                File.Copy(file, nuspecFile, true);

                // Recurse the directories, looking for files which opted into the package
                var selectedContent = new List <string>();
                FilterForFiles(config.SourceDirectory, selectedContent, packageName);

                // Announce the files
                AnnounceFiles(pconfig, selectedContent);

                // Move files from source to destination content
                MoveContentInPlace(selectedContent, pconfig, config);

                // Optionally execute NuGet.exe
                if (config.ShouldExecute)
                {
                    string args = string.Format(" pack \"{0}\" -o \"{1}\"", Path.GetFullPath(nuspecFile), Path.GetFullPath(config.DestinationDirectory).TrimEnd('\\'));
                    Console.WriteLine(Path.GetFullPath(config.ExecutePath) + " " + args);
                    var p = Process.Start(Path.GetFullPath(config.ExecutePath), args);
                    p.OutputDataReceived += p_OutputDataReceived;
                    p.Start();
                    p.WaitForExit();
                }
            }
        }
        public void Build(Config config)
        {
            xmlExtensions = new List<string> { ".xml", ".config" };
            var configFiles = Directory.GetFiles(config.ConfigDirectory, "*.nuspec");
            foreach (var file in configFiles)
            {
                var packageName = Path.GetFileNameWithoutExtension(file);
                var pconfig = new PackageConfig(config, packageName);

                // Create all the package directories we'll need
                pconfig.Ensure();

                // Move in the nuspec file
                string nuspecFile = Path.Combine(pconfig.PackageDirectory, Path.GetFileName(file));
                File.Copy(file, nuspecFile, true);

                // Recurse the directories, looking for files which opted into the package 
                var selectedContent = new List<string>();
                FilterForFiles(config.SourceDirectory, selectedContent, packageName);

                // Announce the files
                AnnounceFiles(pconfig, selectedContent);

                // Move files from source to destination content
                MoveContentInPlace(selectedContent, pconfig, config);

                // Optionally execute NuGet.exe
                if (config.ShouldExecute)
                {
                    string args = string.Format(" pack \"{0}\" -o \"{1}\"", Path.GetFullPath(nuspecFile), Path.GetFullPath(config.DestinationDirectory).TrimEnd('\\'));
                    Console.WriteLine(Path.GetFullPath(config.ExecutePath) + " " + args);
                    var p = Process.Start(Path.GetFullPath(config.ExecutePath), args);
                    p.OutputDataReceived += p_OutputDataReceived;
                    p.Start();
                    p.WaitForExit();
                }
            }
        }