[mapguide-commits] r10173 - in branches/4.0/MgDev: Bindings/src/Bindings/DotNet/Portable Bindings/src/Managed/DotNet/Common Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable Portable Portable/DotNetHarness Portable/MapViewerTest Portable/MgAppLayout Portable/MgPortable/Services

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Aug 18 06:49:20 PDT 2025


Author: jng
Date: 2025-08-18 06:49:19 -0700 (Mon, 18 Aug 2025)
New Revision: 10173

Modified:
   branches/4.0/MgDev/Bindings/src/Bindings/DotNet/Portable/PortableApi.vcxproj
   branches/4.0/MgDev/Bindings/src/Managed/DotNet/Common/MgClassMap.cs
   branches/4.0/MgDev/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable/
   branches/4.0/MgDev/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable/OSGeo.MapGuide.Portable.csproj
   branches/4.0/MgDev/Portable/DotNetHarness/Form1.Designer.cs
   branches/4.0/MgDev/Portable/MapViewerTest/MgAppWindow.Designer.cs
   branches/4.0/MgDev/Portable/MgAppLayout/Program.cs
   branches/4.0/MgDev/Portable/MgAppLayout/Sheboygan.AppLayout
   branches/4.0/MgDev/Portable/MgAppLayout/SheboyganTiled.AppLayout
   branches/4.0/MgDev/Portable/MgPortable/Services/MappingService.h
   branches/4.0/MgDev/Portable/MgPortable/Services/RenderingService.h
   branches/4.0/MgDev/Portable/README.md
Log:
Get MgPortable bindings working. The issues were:
 - Didn't bundle gd.dll into the nuget package
 - Didn't include Schema and Resources directories in the nuget package
 - Fix incorrect class id assignment on Rendering and Mapping services that caused .net service downcasts to fail

Also do some final "Desktop" -> "Portable" replacements

Modified: branches/4.0/MgDev/Bindings/src/Bindings/DotNet/Portable/PortableApi.vcxproj
===================================================================
--- branches/4.0/MgDev/Bindings/src/Bindings/DotNet/Portable/PortableApi.vcxproj	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Bindings/src/Bindings/DotNet/Portable/PortableApi.vcxproj	2025-08-18 13:49:19 UTC (rev 10173)
@@ -67,6 +67,7 @@
 "..\..\..\IMake\$(Platform)\$(Configuration)\bin\IMake.exe" -p "$(ProjectDir)PortableApiGen.xml" -l C# -x "PortableApi"
 "$(SWIG_DIR)\swig.exe" -c++ -csharp -DDOTNETCORE -DWIN32 -DSWIG_CSHARP_NO_EXCEPTION_HELPER -DSWIG_CSHARP_NO_STRING_HELPER -DSWIG_CSHARP_NO_WSTRING_HELPER -DSWIG_CSHARP_NO_WSTRING_EXCEPTION_HELPER -namespace OSGeo.MapGuide -nodefaultctor -nodefaultdtor -module PortableUnmanagedApi -o "$(ProjectDir)PortableUnmanagedApi_wrap.cpp" -outdir "$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Portable" PortableApi.i
 del /Q ..\..\..\Managed\DotNet\OSGeo.MapGuide.Portable\PortableUnmanagedApi.cs
+copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\gd.dll" "$(TargetDir)\native\"
 copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\MgPortable.dll" "$(TargetDir)\native\"
 copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\MgGws*.dll" "$(TargetDir)\native\"
 copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\MgRenderers.dll" "$(TargetDir)\native\"
@@ -77,6 +78,8 @@
 del /q "$(TargetDir)\..\..\FDO\OSGeo.FDO.*"
 copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\FDO\providers.xml" "$(TargetDir)\..\..\FDO"
 xcopy /S /Y /I "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\Dictionaries" "$(TargetDir)\..\..\Dictionaries\"
+xcopy /S /Y /I "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\Resources" "$(TargetDir)\..\..\Resources\"
+xcopy /S /Y /I "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\Schema" "$(TargetDir)\..\..\Schema\"
 </Command>
     </PreBuildEvent>
     <ClCompile>
@@ -118,6 +121,7 @@
 "..\..\..\IMake\$(Platform)\$(Configuration)\bin\IMake.exe" -p "$(ProjectDir)PortableApiGen.xml" -l C# -x "PortableApi"
 "$(SWIG_DIR)\swig.exe" -c++ -csharp -DDOTNETCORE -DWIN32 -DSWIG_CSHARP_NO_EXCEPTION_HELPER -DSWIG_CSHARP_NO_STRING_HELPER -DSWIG_CSHARP_NO_WSTRING_HELPER -DSWIG_CSHARP_NO_WSTRING_EXCEPTION_HELPER -namespace OSGeo.MapGuide -nodefaultctor -nodefaultdtor -module PortableUnmanagedApi -o "$(ProjectDir)PortableUnmanagedApi_wrap.cpp" -outdir "$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Portable" PortableApi.i
 del /Q ..\..\..\Managed\DotNet\OSGeo.MapGuide.Portable\PortableUnmanagedApi.cs
+copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\gd.dll" "$(TargetDir)\native\"
 copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\MgPortable.dll" "$(TargetDir)\native\"
 copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\MgGws*.dll" "$(TargetDir)\native\"
 copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\MgRenderers.dll" "$(TargetDir)\native\"
@@ -128,6 +132,8 @@
 del /q "$(TargetDir)\..\..\FDO\OSGeo.FDO.*"
 copy /Y "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\FDO\providers.xml" "$(TargetDir)\..\..\FDO"
 xcopy /S /Y /I "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\Dictionaries" "$(TargetDir)\..\..\Dictionaries\"
+xcopy /S /Y /I "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\Resources" "$(TargetDir)\..\..\Resources\"
+xcopy /S /Y /I "$(ProjectDir)..\..\..\..\..\Portable\bin\$(Configuration)64\Schema" "$(TargetDir)\..\..\Schema\"
 </Command>
     </PreBuildEvent>
     <ClCompile>

Modified: branches/4.0/MgDev/Bindings/src/Managed/DotNet/Common/MgClassMap.cs
===================================================================
--- branches/4.0/MgDev/Bindings/src/Managed/DotNet/Common/MgClassMap.cs	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Bindings/src/Managed/DotNet/Common/MgClassMap.cs	2025-08-18 13:49:19 UTC (rev 10173)
@@ -260,7 +260,10 @@
                 classIdCtorMap[40005] = TryResolveConstructor("OSGeo.MapGuide.MgHttpResponse");
                 classIdCtorMap[40006] = TryResolveConstructor("OSGeo.MapGuide.MgHttpPrimitiveValue");
             }
-#if MG_PORTABLE_API
+
+            // UGLY: It is mildly annoying/hackish that we are incorporating class ids for a library not known
+            // to the majority of the library wrappers that reference this file, but it would be more complicated
+            // work to achieve pure physical MgClassMap/assembly separation.
             if (HasAssemblyInAppDomain("OSGeo.MapGuide.Portable")) {
                 classIdCtorMap[60500] = TryResolveConstructor("OSGeo.MapGuide.MgPortableMap");
                 classIdCtorMap[60501] = TryResolveConstructor("OSGeo.MapGuide.MgPortableLayer");
@@ -283,9 +286,7 @@
                 classIdCtorMap[61300] = TryResolveConstructor("OSGeo.MapGuide.MgPortableKmlService");
                 classIdCtorMap[61400] = TryResolveConstructor("OSGeo.MapGuide.MgPortableProfilingService");
             }
-#endif
 
-
             //Sanity check that we haven't double registered the same type name under different
             //class ids (Only possible when class id is being accidentally reused in a base or 
             //derived C++ class)

Index: branches/4.0/MgDev/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable
===================================================================
--- branches/4.0/MgDev/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable	2025-08-18 13:49:19 UTC (rev 10173)

Property changes on: branches/4.0/MgDev/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable
___________________________________________________________________
Modified: svn:ignore
## -2,3 +2,5 ##
 *.cs
 Dictionaries
 FDO
+Resources
+Schema
Modified: branches/4.0/MgDev/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable/OSGeo.MapGuide.Portable.csproj
===================================================================
--- branches/4.0/MgDev/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable/OSGeo.MapGuide.Portable.csproj	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Portable/OSGeo.MapGuide.Portable.csproj	2025-08-18 13:49:19 UTC (rev 10173)
@@ -62,6 +62,20 @@
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
       <CopyToPublishDirectory>Always</CopyToPublishDirectory>
     </None>
+	<None Update="Resources\*" 
+          Pack="true" 
+          PackagePath="contentFiles\any\any">
+      <PackageCopyToOutput>true</PackageCopyToOutput>
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <CopyToPublishDirectory>Always</CopyToPublishDirectory>
+    </None>
+	<None Update="Schema\*" 
+          Pack="true" 
+          PackagePath="contentFiles\any\any">
+      <PackageCopyToOutput>true</PackageCopyToOutput>
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <CopyToPublishDirectory>Always</CopyToPublishDirectory>
+    </None>
   </ItemGroup>
 
   <ItemGroup>

Modified: branches/4.0/MgDev/Portable/DotNetHarness/Form1.Designer.cs
===================================================================
--- branches/4.0/MgDev/Portable/DotNetHarness/Form1.Designer.cs	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Portable/DotNetHarness/Form1.Designer.cs	2025-08-18 13:49:19 UTC (rev 10173)
@@ -107,7 +107,7 @@
             this.ClientSize = new System.Drawing.Size(918, 591);
             this.Controls.Add(this.splitContainer1);
             this.Name = "Form1";
-            this.Text = "MapGuide Desktop API Test Harness";
+            this.Text = "MapGuide Portable API Test Harness";
             this.splitContainer1.Panel1.ResumeLayout(false);
             this.splitContainer1.Panel1.PerformLayout();
             this.splitContainer1.ResumeLayout(false);

Modified: branches/4.0/MgDev/Portable/MapViewerTest/MgAppWindow.Designer.cs
===================================================================
--- branches/4.0/MgDev/Portable/MapViewerTest/MgAppWindow.Designer.cs	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Portable/MapViewerTest/MgAppWindow.Designer.cs	2025-08-18 13:49:19 UTC (rev 10173)
@@ -1383,7 +1383,7 @@
             this.Controls.Add(this.appMenu);
             this.Name = "MgAppWindow";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
-            this.Text = "MapGuide Desktop Viewer";
+            this.Text = "MapGuide Portable Viewer";
             this.appMenu.ResumeLayout(false);
             this.appMenu.PerformLayout();
             this.appContextMenu.ResumeLayout(false);

Modified: branches/4.0/MgDev/Portable/MgAppLayout/Program.cs
===================================================================
--- branches/4.0/MgDev/Portable/MgAppLayout/Program.cs	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Portable/MgAppLayout/Program.cs	2025-08-18 13:49:19 UTC (rev 10173)
@@ -49,7 +49,7 @@
             }/*
             else
             {
-                layout = AppLayout.CreateDefault("MapGuide Desktop App Layout Example", "Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
+                layout = AppLayout.CreateDefault("MapGuide Portable App Layout Example", "Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
                 using (var file = File.OpenWrite("Sheboygan.AppLayout"))
                 {
                     ser.Serialize(file, layout);

Modified: branches/4.0/MgDev/Portable/MgAppLayout/Sheboygan.AppLayout
===================================================================
--- branches/4.0/MgDev/Portable/MgAppLayout/Sheboygan.AppLayout	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Portable/MgAppLayout/Sheboygan.AppLayout	2025-08-18 13:49:19 UTC (rev 10173)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <AppLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-  <Title>MapGuide Desktop App Layout Example (Untiled)</Title>
+  <Title>MapGuide Portable App Layout Example (Untiled)</Title>
   <Icon>app.ico</Icon>
   <Settings>
     <NameValue>

Modified: branches/4.0/MgDev/Portable/MgAppLayout/SheboyganTiled.AppLayout
===================================================================
--- branches/4.0/MgDev/Portable/MgAppLayout/SheboyganTiled.AppLayout	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Portable/MgAppLayout/SheboyganTiled.AppLayout	2025-08-18 13:49:19 UTC (rev 10173)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <AppLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-  <Title>MapGuide Desktop App Layout Example (Tiled Map)</Title>
+  <Title>MapGuide Portable App Layout Example (Tiled Map)</Title>
   <Icon>app.ico</Icon>
   <Settings>
     <NameValue>

Modified: branches/4.0/MgDev/Portable/MgPortable/Services/MappingService.h
===================================================================
--- branches/4.0/MgDev/Portable/MgPortable/Services/MappingService.h	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Portable/MgPortable/Services/MappingService.h	2025-08-18 13:49:19 UTC (rev 10173)
@@ -228,7 +228,7 @@
     virtual void Dispose() { delete this; }
 
 CLASS_ID:
-    static const INT32 m_cls_id = Portable_RenderingService_RenderingService;
+    static const INT32 m_cls_id = Portable_MappingService_MappingService;
 };
 /// \}
 #endif
\ No newline at end of file

Modified: branches/4.0/MgDev/Portable/MgPortable/Services/RenderingService.h
===================================================================
--- branches/4.0/MgDev/Portable/MgPortable/Services/RenderingService.h	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Portable/MgPortable/Services/RenderingService.h	2025-08-18 13:49:19 UTC (rev 10173)
@@ -549,7 +549,7 @@
     virtual void Dispose() { delete this; }
 
 CLASS_ID:
-    static const INT32 m_cls_id = Portable_MappingService_MappingService;
+    static const INT32 m_cls_id = Portable_RenderingService_RenderingService;
 };
 /// \}
 #endif
\ No newline at end of file

Modified: branches/4.0/MgDev/Portable/README.md
===================================================================
--- branches/4.0/MgDev/Portable/README.md	2025-08-18 10:44:38 UTC (rev 10172)
+++ branches/4.0/MgDev/Portable/README.md	2025-08-18 13:49:19 UTC (rev 10173)
@@ -31,7 +31,7 @@
 In there, init the MapGuide dev environment like so:
 
 ```
-setenvironment64.bat x86_amd64
+setenvironment64.bat release
 ```
 
 Then you can run `devenv` to launch Visual Studio initialized with the environment variables set by the preceding `setenvironment64.bat`
@@ -60,6 +60,4 @@
 
 Once MapGuide Portable has been built and the aforementioned nuget packages are present, you can build `Portable/PortableApps.sln` in Visual Studio.
 
-> NOTE: This section below is currently false, but it is our intended goal.
-
 As all the MapGuide nuget packages adhere to the packaging rules around native libraries, any project in `Portable/PortableApps.sln` can be launched from Visual Studio without any post build dll copying required.
\ No newline at end of file



More information about the mapguide-commits mailing list