Example #1
0
        private void OnCleanUp()
        {
            String sourceRoot = ConfigurationManager.AppSettings["source_root"];
            String csprojName = ConfigurationManager.AppSettings["csproj_name"];

            String csprojFile = sourceRoot + csprojName;

            Project project = new Project();
            project.Load(csprojFile);

            project.RemoveItemsByName("Content");

            // 补上img文件夹
            BuildItemGroup itemGroup = project.AddNewItemGroup();
            String[] bookFiles = Directory.GetFileSystemEntries(sourceRoot + "_static\\img\\");

            foreach (var file in bookFiles)
            {
                itemGroup.AddNewItem("Content", "_static\\img\\" + Path.GetFileName(file));
            }

            project.Save(csprojFile);
        }