[mapguide-commits] r6739 - in branches/2.4/MgDev: . BuildTools/WebTools BuildTools/WebTools/SetAssemblyVersion BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Properties BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 8 23:50:00 PDT 2012


Author: jng
Date: 2012-06-08 23:50:00 -0700 (Fri, 08 Jun 2012)
New Revision: 6739

Added:
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion.sln
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Program.cs
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Properties/
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Properties/AssemblyInfo.cs
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/SetAssemblyVersion.csproj
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.exe
   branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.pdb
   branches/2.4/MgDev/stampassemblies.bat
Log:
#2024: Add a SetAssemblyInfo project to BuildTools/WebTools. This is a small utility to set the appropriate version number in an AssemblyInfo.cs file. Add a new stampassemblies.bat, which takes a single parameter (the version in major.minor.build.revision format). This will stamp the .net API and the mg-desktop .net API AssemblyInfo files.


Property changes on: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion
___________________________________________________________________
Added: svn:ignore
   + *.suo



Property changes on: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion
___________________________________________________________________
Added: svn:ignore
   + obj


Added: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Program.cs
===================================================================
--- branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Program.cs	                        (rev 0)
+++ branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Program.cs	2012-06-09 06:50:00 UTC (rev 6739)
@@ -0,0 +1,139 @@
+using System;
+using System.IO;
+using System.Text;
+
+namespace SetAssemblyVersion
+{
+    /// <summary>
+    /// A small utility to stamp the version of our .net API assemblies
+    /// 
+    /// Original source: http://www.codeproject.com/Articles/31236/How-To-Update-Assembly-Version-Number-Automaticall
+    /// </summary>
+    class AssemblyInfoUtil
+    {
+        private static int incParamNum = 0;
+
+        private static string fileName = "";
+
+        private static string versionStr = null;
+
+        private static bool isVB = false;
+
+        /// <summary>
+        /// The main entry point for the application.
+        /// </summary>
+        [STAThread]
+        static void Main(string[] args)
+        {
+            for (int i = 0; i < args.Length; i++)
+            {
+                if (args[i].StartsWith("-inc:"))
+                {
+                    string s = args[i].Substring("-inc:".Length);
+                    incParamNum = int.Parse(s);
+                }
+                else if (args[i].StartsWith("-set:"))
+                {
+                    versionStr = args[i].Substring("-set:".Length);
+                }
+                else
+                    fileName = args[i];
+            }
+
+            if (Path.GetExtension(fileName).ToLower() == ".vb")
+                isVB = true;
+
+            if (fileName == "")
+            {
+                System.Console.WriteLine("Usage: AssemblyInfoUtil <path to AssemblyInfo.cs or AssemblyInfo.vb file> [options]");
+                System.Console.WriteLine("Options: ");
+                System.Console.WriteLine("  -set:<new version number> - set new version number (in NN.NN.NN.NN format)");
+                System.Console.WriteLine("  -inc:<parameter index>  - increases the parameter with specified index (can be from 1 to 4)");
+                return;
+            }
+
+            if (!File.Exists(fileName))
+            {
+                System.Console.WriteLine("Error: Can not find file \"" + fileName + "\"");
+                return;
+            }
+
+            System.Console.Write("Processing \"" + fileName + "\"...");
+            StreamReader reader = new StreamReader(fileName);
+            StreamWriter writer = new StreamWriter(fileName + ".out");
+            String line;
+
+            while ((line = reader.ReadLine()) != null)
+            {
+                line = ProcessLine(line);
+                writer.WriteLine(line);
+            }
+            reader.Close();
+            writer.Close();
+
+            File.Delete(fileName);
+            File.Move(fileName + ".out", fileName);
+            System.Console.WriteLine("Done!");
+        }
+
+        private static string ProcessLine(string line)
+        {
+            if (isVB)
+            {
+                line = ProcessLinePart(line, "<Assembly: AssemblyVersion(\"");
+                line = ProcessLinePart(line, "<Assembly: AssemblyFileVersion(\"");
+            }
+            else
+            {
+                line = ProcessLinePart(line, "[assembly: AssemblyVersion(\"");
+                line = ProcessLinePart(line, "[assembly: AssemblyFileVersion(\"");
+            }
+            return line;
+        }
+
+        private static string ProcessLinePart(string line, string part)
+        {
+            int spos = line.IndexOf(part);
+            if (spos >= 0)
+            {
+                spos += part.Length;
+                int epos = line.IndexOf('"', spos);
+                string oldVersion = line.Substring(spos, epos - spos);
+                string newVersion = "";
+                bool performChange = false;
+
+                if (incParamNum > 0)
+                {
+                    string[] nums = oldVersion.Split('.');
+                    if (nums.Length >= incParamNum && nums[incParamNum - 1] != "*")
+                    {
+                        Int64 val = Int64.Parse(nums[incParamNum - 1]);
+                        val++;
+                        nums[incParamNum - 1] = val.ToString();
+                        newVersion = nums[0];
+                        for (int i = 1; i < nums.Length; i++)
+                        {
+                            newVersion += "." + nums[i];
+                        }
+                        performChange = true;
+                    }
+                }
+
+                else if (versionStr != null)
+                {
+                    newVersion = versionStr;
+                    performChange = true;
+                }
+
+                if (performChange)
+                {
+                    StringBuilder str = new StringBuilder(line);
+                    str.Remove(spos, epos - spos);
+                    str.Insert(spos, newVersion);
+                    line = str.ToString();
+                }
+            }
+            return line;
+        }
+    }
+}

Added: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Properties/AssemblyInfo.cs
===================================================================
--- branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Properties/AssemblyInfo.cs	                        (rev 0)
+++ branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Properties/AssemblyInfo.cs	2012-06-09 06:50:00 UTC (rev 6739)
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SetAssemblyVersion")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SetAssemblyVersion")]
+[assembly: AssemblyCopyright("Copyright ©  2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("742bc60a-1bd9-47a1-8bbc-51827d2ba415")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Added: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/SetAssemblyVersion.csproj
===================================================================
--- branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/SetAssemblyVersion.csproj	                        (rev 0)
+++ branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/SetAssemblyVersion.csproj	2012-06-09 06:50:00 UTC (rev 6739)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{FB6810AB-F710-4542-A55C-9DB8AB151B06}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>SetAssemblyVersion</RootNamespace>
+    <AssemblyName>SetAssemblyVersion</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file


Property changes on: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin
___________________________________________________________________
Added: svn:ignore
   + Debug


Added: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.exe
===================================================================
(Binary files differ)


Property changes on: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.exe
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.pdb
===================================================================
(Binary files differ)


Property changes on: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.pdb
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion.sln
===================================================================
--- branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion.sln	                        (rev 0)
+++ branches/2.4/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion.sln	2012-06-09 06:50:00 UTC (rev 6739)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SetAssemblyVersion", "SetAssemblyVersion\SetAssemblyVersion.csproj", "{FB6810AB-F710-4542-A55C-9DB8AB151B06}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{FB6810AB-F710-4542-A55C-9DB8AB151B06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{FB6810AB-F710-4542-A55C-9DB8AB151B06}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{FB6810AB-F710-4542-A55C-9DB8AB151B06}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{FB6810AB-F710-4542-A55C-9DB8AB151B06}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Added: branches/2.4/MgDev/stampassemblies.bat
===================================================================
--- branches/2.4/MgDev/stampassemblies.bat	                        (rev 0)
+++ branches/2.4/MgDev/stampassemblies.bat	2012-06-09 06:50:00 UTC (rev 6739)
@@ -0,0 +1,25 @@
+ at echo off
+SET PATH=%PATH%;%CD%\BuildTools\WebTools\SetAssemblyVersion\SetAssemblyVersion\bin\Release
+SET VERSION=%1
+echo Stamping version %VERSION% to all instances of AssemblyInfo.cs
+pushd "%CD%\Web\src\DotNetApi"
+SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
+popd
+pushd "%CD%\Web\src\DotNetApi\Foundation"
+SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
+popd
+pushd "%CD%\Web\src\DotNetApi\Geometry"
+SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
+popd
+pushd "%CD%\Web\src\DotNetApi\MapGuideCommon"
+SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
+popd
+pushd "%CD%\Web\src\DotNetApi\PlatformBase"
+SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
+popd
+pushd "%CD%\Web\src\DotNetApi\Web"
+SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
+popd
+pushd "%CD%\Desktop\DesktopUnmanagedApi\DotNet\Partials"
+SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
+popd
\ No newline at end of file



More information about the mapguide-commits mailing list