[mapguide-commits] r9989 - in trunk/MgDev: . BuildTools/WebTools/SetAssemblyVersion BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release Portable/DesktopUnmanagedApi/DotNet/Partials Portable/MapViewer/Properties Portable/MapViewer.Desktop/Properties Portable/MgAppLayout/Properties

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Oct 17 04:04:34 PDT 2022


Author: jng
Date: 2022-10-17 04:04:34 -0700 (Mon, 17 Oct 2022)
New Revision: 9989

Modified:
   trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion.sln
   trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Program.cs
   trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/SetAssemblyVersion.csproj
   trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.exe
   trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.pdb
   trunk/MgDev/Portable/DesktopUnmanagedApi/DotNet/Partials/AssemblyInfo.cs
   trunk/MgDev/Portable/MapViewer.Desktop/Properties/AssemblyInfo.cs
   trunk/MgDev/Portable/MapViewer/Properties/AssemblyInfo.cs
   trunk/MgDev/Portable/MgAppLayout/Properties/AssemblyInfo.cs
   trunk/MgDev/stampassemblies.bat
Log:
#2852: Fix up SetAssemblyVersion tool to allow stamping SDK csproj files as well.

Also establish base version 4.0.0.0 on more AssemblyInfo.cs files

Modified: trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Program.cs
===================================================================
--- trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Program.cs	2022-10-17 10:30:34 UTC (rev 9988)
+++ trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/Program.cs	2022-10-17 11:04:34 UTC (rev 9989)
@@ -4,6 +4,13 @@
 
 namespace SetAssemblyVersion
 {
+    enum StampTargetKind
+    {
+        CSharpAssemblyInfo,
+        VBAssemblyInfo,
+        SdkStyleCsProj
+    }
+
     /// <summary>
     /// A small utility to stamp the version of our .net API assemblies
     /// 
@@ -17,7 +24,7 @@
 
         private static string versionStr = null;
 
-        private static bool isVB = false;
+        private static StampTargetKind targetKind = StampTargetKind.CSharpAssemblyInfo;
 
         /// <summary>
         /// The main entry point for the application.
@@ -40,12 +47,16 @@
                     fileName = args[i];
             }
 
-            if (Path.GetExtension(fileName).ToLower() == ".vb")
-                isVB = true;
+            var ext = Path.GetExtension(fileName).ToLower();
+            if (ext == ".vb")
+                targetKind = StampTargetKind.VBAssemblyInfo;
+            else if (ext == ".csproj")
+                targetKind = StampTargetKind.SdkStyleCsProj;
 
+
             if (fileName == "")
             {
-                System.Console.WriteLine("Usage: AssemblyInfoUtil <path to AssemblyInfo.cs or AssemblyInfo.vb file> [options]");
+                System.Console.WriteLine("Usage: AssemblyInfoUtil <path to AssemblyInfo.cs or AssemblyInfo.vb file or SDK-style .csproj 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)");
@@ -78,12 +89,25 @@
 
         private static string ProcessLine(string line)
         {
-            if (isVB)
+            if (targetKind == StampTargetKind.VBAssemblyInfo)
             {
                 line = ProcessLinePart(line, "<Assembly: AssemblyVersion(\"");
                 line = ProcessLinePart(line, "<Assembly: AssemblyFileVersion(\"");
                 line = ProcessLinePart(line, "<Assembly: AssemblyInformationalVersion(\"");
             }
+            else if (targetKind == StampTargetKind.SdkStyleCsProj)
+            {
+                // A SDK-style .csproj file has a <Version> element we want
+                // to update with the input version
+                int iVerStart = line.IndexOf("<Version>");
+                int iVerEnd = line.IndexOf("</Version>");
+                if (iVerStart >= 0 && iVerEnd > iVerStart)
+                {
+                    line = line.Substring(0, iVerStart + "<Version>".Length)
+                        + versionStr
+                        + line.Substring(iVerEnd);
+                }
+            }
             else
             {
                 line = ProcessLinePart(line, "[assembly: AssemblyVersion(\"");

Modified: trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/SetAssemblyVersion.csproj
===================================================================
--- trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/SetAssemblyVersion.csproj	2022-10-17 10:30:34 UTC (rev 9988)
+++ trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/SetAssemblyVersion.csproj	2022-10-17 11:04:34 UTC (rev 9989)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -12,6 +12,11 @@
     <AssemblyName>SetAssemblyVersion</AssemblyName>
     <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>3.5</OldToolsVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>

Modified: trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.exe
===================================================================
(Binary files differ)

Modified: trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion/bin/Release/SetAssemblyVersion.pdb
===================================================================
(Binary files differ)

Modified: trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion.sln
===================================================================
--- trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion.sln	2022-10-17 10:30:34 UTC (rev 9988)
+++ trunk/MgDev/BuildTools/WebTools/SetAssemblyVersion/SetAssemblyVersion.sln	2022-10-17 11:04:34 UTC (rev 9989)
@@ -1,6 +1,8 @@
 
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.3.32901.215
+MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SetAssemblyVersion", "SetAssemblyVersion\SetAssemblyVersion.csproj", "{FB6810AB-F710-4542-A55C-9DB8AB151B06}"
 EndProject
 Global
@@ -17,4 +19,7 @@
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {6EC2B2CF-E988-4E9C-AEF9-666962AC6C09}
+	EndGlobalSection
 EndGlobal

Modified: trunk/MgDev/Portable/DesktopUnmanagedApi/DotNet/Partials/AssemblyInfo.cs
===================================================================
--- trunk/MgDev/Portable/DesktopUnmanagedApi/DotNet/Partials/AssemblyInfo.cs	2022-10-17 10:30:34 UTC (rev 9988)
+++ trunk/MgDev/Portable/DesktopUnmanagedApi/DotNet/Partials/AssemblyInfo.cs	2022-10-17 11:04:34 UTC (rev 9989)
@@ -45,9 +45,9 @@
 // You can specify all the values or you can default the Revision and Build Numbers
 // by using the '*' as shown below:
 
-[assembly: AssemblyVersion("3.1.0.0")]
-[assembly: AssemblyFileVersion("3.1.0.0")]
-[assembly: AssemblyInformationalVersion("3.1.0.0")]
+[assembly: AssemblyVersion("4.0.0.0")]
+[assembly: AssemblyFileVersion("4.0.0.0")]
+[assembly: AssemblyInformationalVersion("4.0.0.0")]
 
 //
 // In order to sign your assembly you must specify a key to use. Refer to the

Modified: trunk/MgDev/Portable/MapViewer/Properties/AssemblyInfo.cs
===================================================================
--- trunk/MgDev/Portable/MapViewer/Properties/AssemblyInfo.cs	2022-10-17 10:30:34 UTC (rev 9988)
+++ trunk/MgDev/Portable/MapViewer/Properties/AssemblyInfo.cs	2022-10-17 11:04:34 UTC (rev 9989)
@@ -31,8 +31,8 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("3.1.0.0")]
-[assembly: AssemblyVersion("3.1.0.0")]
-[assembly: AssemblyFileVersion("3.1.0.0")]
+// [assembly: AssemblyVersion("4.0.0.0")]
+[assembly: AssemblyVersion("4.0.0.0")]
+[assembly: AssemblyFileVersion("4.0.0.0")]
 
 [assembly: AssemblyKeyFile("..\\DesktopUnmanagedApi\\DotNet\\MgPortable.snk")]

Modified: trunk/MgDev/Portable/MapViewer.Desktop/Properties/AssemblyInfo.cs
===================================================================
--- trunk/MgDev/Portable/MapViewer.Desktop/Properties/AssemblyInfo.cs	2022-10-17 10:30:34 UTC (rev 9988)
+++ trunk/MgDev/Portable/MapViewer.Desktop/Properties/AssemblyInfo.cs	2022-10-17 11:04:34 UTC (rev 9989)
@@ -31,8 +31,8 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("3.1.0.0")]
-[assembly: AssemblyVersion("3.1.0.0")]
-[assembly: AssemblyFileVersion("3.1.0.0")]
+// [assembly: AssemblyVersion("4.0.0.0")]
+[assembly: AssemblyVersion("4.0.0.0")]
+[assembly: AssemblyFileVersion("4.0.0.0")]
 
 [assembly: AssemblyKeyFile("..\\DesktopUnmanagedApi\\DotNet\\MgPortable.snk")]

Modified: trunk/MgDev/Portable/MgAppLayout/Properties/AssemblyInfo.cs
===================================================================
--- trunk/MgDev/Portable/MgAppLayout/Properties/AssemblyInfo.cs	2022-10-17 10:30:34 UTC (rev 9988)
+++ trunk/MgDev/Portable/MgAppLayout/Properties/AssemblyInfo.cs	2022-10-17 11:04:34 UTC (rev 9989)
@@ -31,6 +31,6 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("3.1.0.0")]
-[assembly: AssemblyVersion("3.1.0.0")]
-[assembly: AssemblyFileVersion("3.1.0.0")]
+// [assembly: AssemblyVersion("4.0.0.0")]
+[assembly: AssemblyVersion("4.0.0.0")]
+[assembly: AssemblyFileVersion("4.0.0.0")]

Modified: trunk/MgDev/stampassemblies.bat
===================================================================
--- trunk/MgDev/stampassemblies.bat	2022-10-17 10:30:34 UTC (rev 9988)
+++ trunk/MgDev/stampassemblies.bat	2022-10-17 11:04:34 UTC (rev 9989)
@@ -1,34 +1,47 @@
 @echo off
 SET PATH=%PATH%;%CD%\BuildTools\WebTools\SetAssemblyVersion\SetAssemblyVersion\bin\Release
 SET VERSION=%1
+echo Stamping version %VERSION% to all relevant csproj files
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.Foundation"
+SetAssemblyVersion.exe -set:%1 OSGeo.MapGuide.Foundation.csproj
+popd
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.Geometry"
+SetAssemblyVersion.exe -set:%1 OSGeo.MapGuide.Geometry.csproj
+popd
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.MapGuideCommon"
+SetAssemblyVersion.exe -set:%1 OSGeo.MapGuide.MapGuideCommon.csproj
+popd
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.PlatformBase"
+SetAssemblyVersion.exe -set:%1 OSGeo.MapGuide.PlatformBase.csproj
+popd
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.Web"
+SetAssemblyVersion.exe -set:%1 OSGeo.MapGuide.Web.csproj
+popd
 echo Stamping version %VERSION% to all instances of AssemblyInfo.cs
-pushd "%CD%\Web\src\DotNetApi"
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.Foundation\Properties"
 SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
 popd
-pushd "%CD%\Web\src\DotNetApi\Foundation"
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.Geometry\Properties"
 SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
 popd
-pushd "%CD%\Web\src\DotNetApi\Geometry"
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.MapGuideCommon\Properties"
 SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
 popd
-pushd "%CD%\Web\src\DotNetApi\MapGuideCommon"
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.PlatformBase\Properties"
 SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
 popd
-pushd "%CD%\Web\src\DotNetApi\PlatformBase"
+pushd "%CD%\Bindings\src\Managed\DotNet\OSGeo.MapGuide.Web\Properties"
 SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
 popd
-pushd "%CD%\Web\src\DotNetApi\Web"
+pushd "%CD%\Portable\DesktopUnmanagedApi\DotNet\Partials"
 SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
 popd
-pushd "%CD%\Desktop\DesktopUnmanagedApi\DotNet\Partials"
+pushd "%CD%\Portable\MgAppLayout\Properties"
 SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
 popd
-pushd "%CD%\Desktop\MgAppLayout\Properties"
+pushd "%CD%\Portable\MapViewer\Properties"
 SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
 popd
-pushd "%CD%\Desktop\MapViewer\Properties"
+pushd "%CD%\Portable\MapViewer.Desktop\Properties"
 SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
-popd
-pushd "%CD%\Desktop\MapViewer.Desktop\Properties"
-SetAssemblyVersion.exe -set:%1 AssemblyInfo.cs
 popd
\ No newline at end of file



More information about the mapguide-commits mailing list