Hi,
i got stuck with new requirement..
how to create a windows service to take zip of folder whose path stored in xml
and make the service starts automatically with log file
 
Thanks in advance
   #region Project Backup Generator
        private static void BackupProjects()
        {
            try
            {
                ProjectList lstProjects = new ProjectList();
                XmlDocument doc = new XmlDocument();
                doc.Load("ProjectPath.xml");
                XmlElement root = doc.DocumentElement;
                XmlNodeList nodes = root.SelectNodes("/projects/project"); // You can also use XPath here
                //Read xml file and get a list of projects of which backup has to be taken
                foreach (XmlNode node in nodes)
                {
                    string name = node["name"].InnerText;
                    string path = node["path"].InnerText;
                    //Console.WriteLine("Name = " + name + " ,Path = " + path);
                    lstProjects.Add(new Project() { Name = name, Path = path });
                }
                //Now creating zip file of projects from the List<Project> collection
                IEnumerable iEnumProject = lstProjects;
                if (lstProjects.Count > 0)
                {
                    foreach (Project item in iEnumProject)
                    {
                        AddToZip(item);
                    }
                }
            }
            catch (Exception) { LogWritter.WriteLog("Unable to locate xml file on " + DateTime.Now.ToString()); }
        }
        public static void AddToZip(Project project)
        {
            string ZipFileName = string.Empty;
            string ZipFilePath = string.Empty;
            GetFileName(project, out ZipFileName, out ZipFilePath);
            if ((!string.IsNullOrEmpty(ZipFileName)) && (!string.IsNullOrEmpty(ZipFilePath)))
            {
                using (ZipFile zip = new ZipFile())
                {
                    zip.StatusMessageTextWriter = System.Console.Out;
                    zip.AddDirectory(project.Path); // recurses subdirectories
                    zip.Save(ZipFilePath);
                    LogWritter.WriteLog("Backup of project" + project.Name + " taken on " + DateTime.Now.ToString());
                }
            }
            else { LogWritter.WriteLog("Backup of project" + project.Name + " already exists on " + DateTime.Now.ToString()); }
        }
        public static void GetFileName(Project project, out string ZipFileName, out string ZipFilePath)
        {
            string BackupFilePath = string.Empty;
            int dd = DateTime.Now.Day;
            int mm = DateTime.Now.Month;
            int yy = DateTime.Now.Year;
            int hh = DateTime.Now.Hour;
            int mn = DateTime.Now.Minute;
            int ss = DateTime.Now.Second;
            string monthName = DateTime.Now.ToString("MMM");
            string ZipName = string.Concat(project.Name, "_", dd.ToString(), "_", monthName, "_", yy.ToString(), ".zip");
            BackupFilePath = BackupCreator.Default.BackupPath.ToString();
            string ZipPath = string.Concat(BackupFilePath, @"\", ZipName);
            FileInfo fInfo = new FileInfo(string.Concat(BackupFilePath, @"\", ZipName));
            if (fInfo.Exists == true) { ZipFileName = string.Empty; ZipFilePath = string.Empty; }
            else { ZipFileName = ZipName; ZipFilePath = ZipPath; }
        }
        #endregion
.....this is a try..