Пример #1
0
        /// <summary>
        /// Updates version # in all files Named AssemblyInfo in the tree with root curPath
        /// </summary>
        public static void UpdateVersion(string curPath, string version)
        {
            var aiName = "AssemblyInfo.cs;GlobalAssemblyInfo.cs";
            var di     = new DirectoryInfo(curPath);

            foreach (var name in aiName.Split(';'))
            {
                if (di.GetFiles(name).Length > 0)
                {
                    var sub = new Substitution {
                        InputFile = name, OutputFile = name, TargetPath = curPath
                    };
                    //MessageBox.Show(curPath);
                    try
                    {
                        sub.UpdateGroup1(@".assembly. AssemblyFileVersion..([0-9.]+)...", version);
                        sub.UpdateGroup1(@".assembly. AssemblyVersion..([0-9.]+)...", version);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            var fiList = di.GetDirectories();

            foreach (var fi in fiList)
            {
                var startsWith = fi.Name.Substring(0, 1);
                if (startsWith == "." || startsWith == "_")
                {
                    continue;
                }
                UpdateVersion(Path.Combine(curPath, fi.Name), version);
            }
        }
Пример #2
0
 /// <summary>
 /// Updates version # in all files Named AssemblyInfo in the tree with root curPath
 /// </summary>
 public static void UpdateVersion(string curPath, string version)
 {
     var aiName = "AssemblyInfo.cs";
     var di = new DirectoryInfo(curPath);
     if (di.GetFiles(aiName).Length > 0)
     {
         var sub = new Substitution { InputFile = aiName, OutputFile = aiName, TargetPath = curPath };
         //MessageBox.Show(curPath);
         try
         {
             sub.UpdateGroup1(@".assembly. AssemblyFileVersion..([0-9.]+)...", version);
             sub.UpdateGroup1(@".assembly. AssemblyVersion..([0-9.]+)...", version);
         }
         catch (Exception)
         {
         }
     }
     var fiList = di.GetDirectories();
     foreach (var fi in fiList)
     {
         var startsWith = fi.Name.Substring(0, 1);
         if (startsWith == "." || startsWith == "_")
             continue;
         UpdateVersion(Path.Combine(curPath, fi.Name), version);
     }
 }