/[RomCheater]/trunk/MSBuild_CurrentVersion/Program.cs
ViewVC logotype

Diff of /trunk/MSBuild_CurrentVersion/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/MSBuild_CurrentVersion/Program.cs	2012/05/28 10:03:08	181
+++ trunk/MSBuild_CurrentVersion/Program.cs	2012/05/28 10:34:02	192
@@ -25,7 +25,9 @@
 
             string version_file = "current-version.txt";
             string full_path = string.Format(@"{0}\{1}", asm_path,version_file);
-            using (FileStream fs = new FileStream(full_path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
+            FileInfo fi = new FileInfo(full_path);
+            if (fi.Exists) fi.Delete();
+            using (FileStream fs = new FileStream(full_path, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite))
             {
                 StreamWriter sw = new StreamWriter(fs);
                 sw.AutoFlush = true;
@@ -42,14 +44,15 @@
                     FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location);
                     string version = fvi.FileVersion;
 #if DEBUG
-                    version.Replace("-release", "-debug");
+                    version = string.Format("{0}", version);
+                    
 #endif
 #if RELEASE
-                   version.Replace("-debug", "-release");
+                   version = version.Replace("-debug", "-release");
 #endif
 
-                    Console.WriteLine(string.Format("    {0} v{1}-{2}", pair.Key, fvi.FileVersion, GetAssemblyArchitecture(asm)));
-                    sw.WriteLine(string.Format("    {0} v{1}-{2}", pair.Key, fvi.FileVersion, GetAssemblyArchitecture(asm)));
+                    Console.WriteLine(string.Format("    {0} v{1}-{2}", pair.Key, version, GetAssemblyArchitecture(asm)));
+                   sw.WriteLine(string.Format("    {0} v{1}-{2}", pair.Key, version, GetAssemblyArchitecture(asm)));
                 }
                 sw.Close();                
             }

 

  ViewVC Help
Powered by ViewVC 1.1.22