[mapguide-commits] r8761 - in trunk/Tools/Maestro: Maestro/packages ProviderTemplate

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Sep 22 08:52:57 PDT 2015


Author: jng
Date: 2015-09-22 08:52:57 -0700 (Tue, 22 Sep 2015)
New Revision: 8761

Modified:
   trunk/Tools/Maestro/Maestro/packages/
   trunk/Tools/Maestro/ProviderTemplate/Form1.Designer.cs
   trunk/Tools/Maestro/ProviderTemplate/Form1.cs
   trunk/Tools/Maestro/ProviderTemplate/ProviderTemplate.csproj
   trunk/Tools/Maestro/ProviderTemplate/packages.config
Log:
#2571: Fix Maestro ProviderTemplate tool for MGOS 3.0 support.

Because the Maestro API now is built with VS2015/Roslyn, it breaks our ProviderTemplate tool as we can no longer shell out to csc.exe to compile the required Maestro provider source files.

We have to do this programmatically with the new Roslyn compiler.

Since we're switching to Roslyn, this submission also removes various options from the tool which are either obsolete or no longer worth supporting:

 - Path to csc.exe (no longer required)
 - Assembly layout (we're assuming the split assembly layout introduced with 2.2 onwards)

While this pretty much should fix the tool, compiling against MGOS 3.0 assemblies exposed issues in the provider source that have to be fixed (the usage of various deprecated APIs that have been removed in 3.0)

Another unresolved issue is that I've yet to figure out how strong naming works in Roslyn, which we'll have to figure out because we're referencing strong-named MapGuide assemblies.


Property changes on: trunk/Tools/Maestro/Maestro/packages
___________________________________________________________________
Modified: svn:ignore
   - DockPanelSuite.2.9.0.0
fleesharp.0.9.27-pre
IronPython.2.7.4
IronPython.StdLib.2.7.4
NUnit.2.6.3
SharpZipLib.0.86.0
TreeViewAdv.1.7.0.0
mapguide-api-base-x86.2.5.2.7949
mg-desktop-net40-x86.2.5.2.7949
mg-desktop-viewer-net40-x86.2.5.2.7949
RestSharp.105.0.1
Moq.4.2.1409.1722
NUnit.2.6.2
IronPython.2.7.5
IronPython.StdLib.2.7.5
Irony.0.9.0
mapguide-api-base-x86.2.6.0.8316
mg-desktop-viewer-x86.2.6.0.8316
mg-desktop-x86.2.6.0.8316
GeoAPI.1.7.3
NetTopologySuite.1.13.3.2
ProjNET4GeoAPI.1.3.0.4
Newtonsoft.Json.6.0.8
RefactoringEssentials.1.1.0
GeoAPI.1.7.3.1
Moq.4.2.1507.0118
Newtonsoft.Json.7.0.1
NUnit.2.6.4
RefactoringEssentials.1.2.0
RestSharp.105.2.1

   + DockPanelSuite.2.9.0.0
fleesharp.0.9.27-pre
IronPython.2.7.4
IronPython.StdLib.2.7.4
NUnit.2.6.3
SharpZipLib.0.86.0
TreeViewAdv.1.7.0.0
mapguide-api-base-x86.2.5.2.7949
mg-desktop-net40-x86.2.5.2.7949
mg-desktop-viewer-net40-x86.2.5.2.7949
RestSharp.105.0.1
Moq.4.2.1409.1722
NUnit.2.6.2
IronPython.2.7.5
IronPython.StdLib.2.7.5
Irony.0.9.0
mapguide-api-base-x86.2.6.0.8316
mg-desktop-viewer-x86.2.6.0.8316
mg-desktop-x86.2.6.0.8316
GeoAPI.1.7.3
NetTopologySuite.1.13.3.2
ProjNET4GeoAPI.1.3.0.4
Newtonsoft.Json.6.0.8
RefactoringEssentials.1.1.0
GeoAPI.1.7.3.1
Moq.4.2.1507.0118
Newtonsoft.Json.7.0.1
NUnit.2.6.4
RefactoringEssentials.1.2.0
RestSharp.105.2.1
Microsoft.CodeAnalysis.Analyzers.1.0.0
Microsoft.CodeAnalysis.Common.1.0.0
Microsoft.CodeAnalysis.CSharp.1.0.0
System.Collections.Immutable.1.1.36
System.Reflection.Metadata.1.0.21


Modified: trunk/Tools/Maestro/ProviderTemplate/Form1.Designer.cs
===================================================================
--- trunk/Tools/Maestro/ProviderTemplate/Form1.Designer.cs	2015-09-21 04:22:58 UTC (rev 8760)
+++ trunk/Tools/Maestro/ProviderTemplate/Form1.Designer.cs	2015-09-22 15:52:57 UTC (rev 8761)
@@ -30,14 +30,8 @@
         {
             this.txtMgDir = new System.Windows.Forms.TextBox();
             this.label2 = new System.Windows.Forms.Label();
-            this.txtFxDir = new System.Windows.Forms.TextBox();
-            this.label4 = new System.Windows.Forms.Label();
-            this.btnFxDir = new System.Windows.Forms.Button();
             this.btnMgDir = new System.Windows.Forms.Button();
             this.label6 = new System.Windows.Forms.Label();
-            this.label7 = new System.Windows.Forms.Label();
-            this.rdPost22 = new System.Windows.Forms.RadioButton();
-            this.rdPre22 = new System.Windows.Forms.RadioButton();
             this.groupBox2 = new System.Windows.Forms.GroupBox();
             this.txtMessages = new System.Windows.Forms.TextBox();
             this.btnBuild = new System.Windows.Forms.Button();
@@ -45,6 +39,9 @@
             this.worker = new System.ComponentModel.BackgroundWorker();
             this.txtMgVersion = new System.Windows.Forms.TextBox();
             this.chkDebug = new System.Windows.Forms.CheckBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.txtAdditionalReferences = new System.Windows.Forms.TextBox();
+            this.btnSaveMessages = new System.Windows.Forms.Button();
             this.groupBox2.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -54,7 +51,7 @@
             | System.Windows.Forms.AnchorStyles.Right)));
             this.txtMgDir.Location = new System.Drawing.Point(12, 71);
             this.txtMgDir.Name = "txtMgDir";
-            this.txtMgDir.Size = new System.Drawing.Size(522, 20);
+            this.txtMgDir.Size = new System.Drawing.Size(703, 20);
             this.txtMgDir.TabIndex = 3;
             this.txtMgDir.Text = "C:\\Program Files\\OSGeo\\MapGuide\\Web\\www\\mapviewernet\\bin";
             // 
@@ -67,40 +64,10 @@
             this.label2.TabIndex = 2;
             this.label2.Text = "MapGuide .net assemblies directory";
             // 
-            // txtFxDir
-            // 
-            this.txtFxDir.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.txtFxDir.Location = new System.Drawing.Point(12, 28);
-            this.txtFxDir.Name = "txtFxDir";
-            this.txtFxDir.Size = new System.Drawing.Size(522, 20);
-            this.txtFxDir.TabIndex = 7;
-            this.txtFxDir.Text = "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319";
-            // 
-            // label4
-            // 
-            this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(9, 12);
-            this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(187, 13);
-            this.label4.TabIndex = 6;
-            this.label4.Text = ".net 4.0 Framework directory (csc.exe)";
-            // 
-            // btnFxDir
-            // 
-            this.btnFxDir.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnFxDir.Location = new System.Drawing.Point(540, 26);
-            this.btnFxDir.Name = "btnFxDir";
-            this.btnFxDir.Size = new System.Drawing.Size(26, 23);
-            this.btnFxDir.TabIndex = 10;
-            this.btnFxDir.Text = "...";
-            this.btnFxDir.UseVisualStyleBackColor = true;
-            this.btnFxDir.Click += new System.EventHandler(this.btnFxDir_Click);
-            // 
             // btnMgDir
             // 
             this.btnMgDir.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnMgDir.Location = new System.Drawing.Point(540, 70);
+            this.btnMgDir.Location = new System.Drawing.Point(721, 70);
             this.btnMgDir.Name = "btnMgDir";
             this.btnMgDir.Size = new System.Drawing.Size(26, 23);
             this.btnMgDir.TabIndex = 12;
@@ -111,52 +78,21 @@
             // label6
             // 
             this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(9, 106);
+            this.label6.Location = new System.Drawing.Point(9, 19);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(144, 13);
             this.label6.TabIndex = 16;
             this.label6.Text = "MapGuide API Version (x.y.z)";
             // 
-            // label7
-            // 
-            this.label7.AutoSize = true;
-            this.label7.Location = new System.Drawing.Point(9, 139);
-            this.label7.Name = "label7";
-            this.label7.Size = new System.Drawing.Size(130, 13);
-            this.label7.TabIndex = 18;
-            this.label7.Text = "MapGuide Assembly Type";
-            // 
-            // rdPost22
-            // 
-            this.rdPost22.AutoSize = true;
-            this.rdPost22.Checked = true;
-            this.rdPost22.Location = new System.Drawing.Point(175, 139);
-            this.rdPost22.Name = "rdPost22";
-            this.rdPost22.Size = new System.Drawing.Size(196, 17);
-            this.rdPost22.TabIndex = 19;
-            this.rdPost22.TabStop = true;
-            this.rdPost22.Text = "2.2 and newer (OSGeo.MapGuide.*)";
-            this.rdPost22.UseVisualStyleBackColor = true;
-            // 
-            // rdPre22
-            // 
-            this.rdPre22.AutoSize = true;
-            this.rdPre22.Location = new System.Drawing.Point(377, 139);
-            this.rdPre22.Name = "rdPre22";
-            this.rdPre22.Size = new System.Drawing.Size(179, 17);
-            this.rdPre22.TabIndex = 20;
-            this.rdPre22.Text = "Pre-2.2 (MapGuideDotNetApi.dll)";
-            this.rdPre22.UseVisualStyleBackColor = true;
-            // 
             // groupBox2
             // 
             this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.groupBox2.Controls.Add(this.txtMessages);
-            this.groupBox2.Location = new System.Drawing.Point(12, 185);
+            this.groupBox2.Location = new System.Drawing.Point(12, 298);
             this.groupBox2.Name = "groupBox2";
-            this.groupBox2.Size = new System.Drawing.Size(554, 189);
+            this.groupBox2.Size = new System.Drawing.Size(735, 164);
             this.groupBox2.TabIndex = 22;
             this.groupBox2.TabStop = false;
             this.groupBox2.Text = "Messages";
@@ -168,14 +104,14 @@
             this.txtMessages.Multiline = true;
             this.txtMessages.Name = "txtMessages";
             this.txtMessages.ReadOnly = true;
-            this.txtMessages.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal;
-            this.txtMessages.Size = new System.Drawing.Size(548, 170);
+            this.txtMessages.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+            this.txtMessages.Size = new System.Drawing.Size(729, 145);
             this.txtMessages.TabIndex = 0;
             // 
             // btnBuild
             // 
             this.btnBuild.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnBuild.Location = new System.Drawing.Point(491, 380);
+            this.btnBuild.Location = new System.Drawing.Point(672, 468);
             this.btnBuild.Name = "btnBuild";
             this.btnBuild.Size = new System.Drawing.Size(75, 23);
             this.btnBuild.TabIndex = 23;
@@ -190,7 +126,7 @@
             // 
             // txtMgVersion
             // 
-            this.txtMgVersion.Location = new System.Drawing.Point(175, 103);
+            this.txtMgVersion.Location = new System.Drawing.Point(175, 16);
             this.txtMgVersion.Name = "txtMgVersion";
             this.txtMgVersion.Size = new System.Drawing.Size(100, 20);
             this.txtMgVersion.TabIndex = 24;
@@ -199,30 +135,55 @@
             // chkDebug
             // 
             this.chkDebug.AutoSize = true;
-            this.chkDebug.Location = new System.Drawing.Point(12, 162);
+            this.chkDebug.Location = new System.Drawing.Point(15, 106);
             this.chkDebug.Name = "chkDebug";
             this.chkDebug.Size = new System.Drawing.Size(84, 17);
             this.chkDebug.TabIndex = 25;
             this.chkDebug.Text = "Build Debug";
             this.chkDebug.UseVisualStyleBackColor = true;
             // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(297, 106);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(222, 13);
+            this.label1.TabIndex = 26;
+            this.label1.Text = "Additional Assembly References (one per line)";
+            // 
+            // txtAdditionalReferences
+            // 
+            this.txtAdditionalReferences.Location = new System.Drawing.Point(300, 123);
+            this.txtAdditionalReferences.Multiline = true;
+            this.txtAdditionalReferences.Name = "txtAdditionalReferences";
+            this.txtAdditionalReferences.Size = new System.Drawing.Size(444, 160);
+            this.txtAdditionalReferences.TabIndex = 27;
+            this.txtAdditionalReferences.Text = "GeoAPI.dll";
+            // 
+            // btnSaveMessages
+            // 
+            this.btnSaveMessages.Location = new System.Drawing.Point(12, 468);
+            this.btnSaveMessages.Name = "btnSaveMessages";
+            this.btnSaveMessages.Size = new System.Drawing.Size(96, 23);
+            this.btnSaveMessages.TabIndex = 28;
+            this.btnSaveMessages.Text = "Save Messages";
+            this.btnSaveMessages.UseVisualStyleBackColor = true;
+            this.btnSaveMessages.Click += new System.EventHandler(this.btnSaveMessages_Click);
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(578, 415);
+            this.ClientSize = new System.Drawing.Size(759, 503);
+            this.Controls.Add(this.btnSaveMessages);
+            this.Controls.Add(this.txtAdditionalReferences);
+            this.Controls.Add(this.label1);
             this.Controls.Add(this.chkDebug);
             this.Controls.Add(this.txtMgVersion);
             this.Controls.Add(this.btnBuild);
             this.Controls.Add(this.groupBox2);
-            this.Controls.Add(this.rdPre22);
-            this.Controls.Add(this.rdPost22);
-            this.Controls.Add(this.label7);
             this.Controls.Add(this.label6);
             this.Controls.Add(this.btnMgDir);
-            this.Controls.Add(this.btnFxDir);
-            this.Controls.Add(this.txtFxDir);
-            this.Controls.Add(this.label4);
             this.Controls.Add(this.txtMgDir);
             this.Controls.Add(this.label2);
             this.Name = "Form1";
@@ -238,14 +199,8 @@
 
         private System.Windows.Forms.TextBox txtMgDir;
         private System.Windows.Forms.Label label2;
-        private System.Windows.Forms.TextBox txtFxDir;
-        private System.Windows.Forms.Label label4;
-        private System.Windows.Forms.Button btnFxDir;
         private System.Windows.Forms.Button btnMgDir;
         private System.Windows.Forms.Label label6;
-        private System.Windows.Forms.Label label7;
-        private System.Windows.Forms.RadioButton rdPost22;
-        private System.Windows.Forms.RadioButton rdPre22;
         private System.Windows.Forms.GroupBox groupBox2;
         private System.Windows.Forms.TextBox txtMessages;
         private System.Windows.Forms.Button btnBuild;
@@ -253,6 +208,9 @@
         private System.ComponentModel.BackgroundWorker worker;
         private System.Windows.Forms.TextBox txtMgVersion;
         private System.Windows.Forms.CheckBox chkDebug;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.TextBox txtAdditionalReferences;
+        private System.Windows.Forms.Button btnSaveMessages;
     }
 }
 

Modified: trunk/Tools/Maestro/ProviderTemplate/Form1.cs
===================================================================
--- trunk/Tools/Maestro/ProviderTemplate/Form1.cs	2015-09-21 04:22:58 UTC (rev 8760)
+++ trunk/Tools/Maestro/ProviderTemplate/Form1.cs	2015-09-22 15:52:57 UTC (rev 8761)
@@ -1,4 +1,6 @@
-using System;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Diagnostics;
@@ -13,13 +15,7 @@
         {
             InitializeComponent();
         }
-
-        private void btnFxDir_Click(object sender, EventArgs e)
-        {
-            if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
-                txtFxDir.Text = folderBrowserDialog.SelectedPath;
-        }
-
+        
         private void btnMgDir_Click(object sender, EventArgs e)
         {
             if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
@@ -28,13 +24,12 @@
 
         private void btnBuild_Click(object sender, EventArgs e)
         {
+            txtMessages.Clear();
             btnBuild.Enabled = false;
             worker.RunWorkerAsync(new BuildArgs()
             {
-                FxDir = txtFxDir.Text,
                 MgDir = txtMgDir.Text,
                 MgVersion = txtMgVersion.Text,
-                RefMapGuideDotNetApi = rdPre22.Checked,
                 DebugMode = chkDebug.Checked
             });
         }
@@ -50,25 +45,70 @@
 
         private class BuildArgs
         {
-            public string FxDir;
             public string MgDir;
             public string MgVersion;
-            public bool RefMapGuideDotNetApi;
             public bool DebugMode;
+
+            public string AssemblyName => $"OSGeo.MapGuide.MaestroAPI.Native-{MgVersion}";
+            public string AssemblyNameWithExtension => $"{AssemblyName}.dll";
         }
 
-        private void worker_DoWork(object sender, DoWorkEventArgs e)
+        void CompileProvider(BuildArgs ba, string keyFile, string outputDir, IEnumerable<string> sourceFiles, IEnumerable<string> referencePaths)
         {
-            var ba = (BuildArgs)e.Argument;
-            AppendMessage("Validating input parameters");
-            if (!Directory.Exists(ba.FxDir))
+            var files = new List<SyntaxTree>();
+            var references = new List<MetadataReference>();
+
+            //Add mscorlib and friends
+            references.Add(MetadataReference.CreateFromFile(typeof(object).Assembly.Location));
+            references.Add(MetadataReference.CreateFromFile(typeof(System.Collections.Specialized.NameValueCollection).Assembly.Location));
+            references.Add(MetadataReference.CreateFromFile(typeof(System.Linq.Enumerable).Assembly.Location));
+            references.Add(MetadataReference.CreateFromFile(typeof(System.Xml.XmlDocument).Assembly.Location));
+            references.Add(MetadataReference.CreateFromFile(typeof(System.Drawing.Color).Assembly.Location));
+            references.Add(MetadataReference.CreateFromFile(typeof(System.Data.CommandType).Assembly.Location));
+
+            foreach (var f in sourceFiles)
             {
-                throw new Exception("The specified .net framework 4.0 directory does not exist");
+                AppendMessage($"Parsing: {f}");
+                files.Add(CSharpSyntaxTree.ParseText(File.ReadAllText(f)));
             }
-            else
+
+            foreach (var f in referencePaths)
             {
-                AppendMessage(".net Framework 4.0  directory found");
+                AppendMessage($"Adding reference: {f}");
+                references.Add(MetadataReference.CreateFromFile(f));
             }
+
+            var options = new CSharpCompilationOptions(
+                outputKind: OutputKind.DynamicallyLinkedLibrary,
+                platform: Platform.AnyCpu,
+                optimizationLevel: ba.DebugMode ? OptimizationLevel.Debug : OptimizationLevel.Release,
+                cryptoKeyFile: keyFile
+            );
+            var comp = CSharpCompilation.Create(ba.AssemblyNameWithExtension, files, references, options);
+            using (var fs = File.OpenWrite(Path.Combine(outputDir, ba.AssemblyNameWithExtension)))
+            {
+                var result = comp.Emit(fs);
+                if (result.Success)
+                {
+                    AppendMessage("Compilation success!");
+                }
+                else
+                {
+                    foreach (var diag in result.Diagnostics)
+                    {
+                        AppendMessage($"{diag.ToString()}");
+                    }
+                    AppendMessage("Compilation failed with errors");
+                    throw new Exception("Compilation failed with errors. See messages for more details");
+                }
+            }
+        }
+
+        private void worker_DoWork(object sender, DoWorkEventArgs e)
+        {
+            var ba = (BuildArgs)e.Argument;
+            AppendMessage("Validating input parameters");
+            
             if (!Directory.Exists(ba.MgDir))
             {
                 throw new Exception("The specified MapGuide .net assemblies directory does not exist");
@@ -152,8 +192,32 @@
             AppendMessage("Write out AssemblyInfo.cs");
             File.WriteAllText(Path.Combine(srcDir.ToString(), "AssemblyInfo.cs"), string.Format(Properties.Resources.AssemblyInfo, ba.MgVersion));
 
-            string asmName = "OSGeo.MapGuide.MaestroAPI.Native-" + ba.MgVersion + ".dll";
+            string asmName = $"{ba.AssemblyName}.dll";
             AppendMessage("http://xkcd.com/303/ - " + asmName);
+            var referencePaths = new List<string>()
+            {
+                Path.Combine(sdkBinDir.ToString(), "OSGeo.MapGuide.MaestroAPI.dll"),
+                Path.Combine(sdkBinDir.ToString(), "OSGeo.MapGuide.ObjectModels.dll"),
+                Path.Combine(libDir.ToString(), "OSGeo.MapGuide.Foundation.dll"),
+                Path.Combine(libDir.ToString(), "OSGeo.MapGuide.Geometry.dll"),
+                Path.Combine(libDir.ToString(), "OSGeo.MapGuide.PlatformBase.dll"),
+                Path.Combine(libDir.ToString(), "OSGeo.MapGuide.MapGuideCommon.dll"),
+                Path.Combine(libDir.ToString(), "OSGeo.MapGuide.Web.dll"),
+            };
+            foreach (string dll in txtAdditionalReferences.Lines)
+            {
+                var dllpath = Path.Combine(sdkBinDir.ToString(), dll);
+                if (!File.Exists(dllpath))
+                {
+                    throw new FileNotFoundException($"ERROR - File not found {dllpath}. Any references you add must be in {sdkBinDir.ToString()}");
+                }
+                referencePaths.Add(dllpath);
+            }
+            var sourceFiles = new List<string>();
+            sourceFiles.AddRange(Directory.GetFiles(srcDir.ToString(), "*.cs"));
+            sourceFiles.AddRange(Directory.GetFiles(srcCmdDir.ToString(), "*.cs"));
+            CompileProvider(ba, keyfile.ToString(), outputDir.ToString(), sourceFiles, referencePaths);
+            /*
             var args = new List<string>();
             if (ba.DebugMode)
             {
@@ -171,19 +235,20 @@
             args.Add("/keyfile:\"" + keyfile + "\"");
             args.Add("/out:\"" + Path.Combine(outputDir.ToString(), asmName) + "\"");
             args.Add("/reference:\"" + Path.Combine(sdkBinDir.ToString(), "OSGeo.MapGuide.MaestroAPI.dll") + "\"");
-            args.Add("/reference:\"" + Path.Combine(sdkBinDir.ToString(), "NetTopologySuite.Merged.dll") + "\"");
-            if (ba.RefMapGuideDotNetApi)
+            foreach (string dll in txtAdditionalReferences.Lines)
             {
-                args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "MapGuideDotNetApi.dll") + "\"");
+                var dllpath = Path.Combine(sdkBinDir.ToString(), dll);
+                if (!File.Exists(dllpath))
+                {
+                    throw new FileNotFoundException($"ERROR - File not found {dllpath}. Any references you add must be in {sdkBinDir.ToString()}");
+                }
+                args.Add("/reference:\"" + dllpath + "\"");
             }
-            else
-            {
-                args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.Foundation.dll") + "\"");
-                args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.Geometry.dll") + "\"");
-                args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.PlatformBase.dll") + "\"");
-                args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.MapGuideCommon.dll") + "\"");
-                args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.Web.dll") + "\"");
-            }
+            args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.Foundation.dll") + "\"");
+            args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.Geometry.dll") + "\"");
+            args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.PlatformBase.dll") + "\"");
+            args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.MapGuideCommon.dll") + "\"");
+            args.Add("/reference:\"" + Path.Combine(libDir.ToString(), "OSGeo.MapGuide.Web.dll") + "\"");
             args.Add("\"" + Path.Combine(srcDir.ToString(), "*.cs") + "\"");
             args.Add("\"" + Path.Combine(srcCmdDir.ToString(), "*.cs") + "\"");
             var cscPath = Path.Combine(ba.FxDir, "csc.exe");
@@ -194,7 +259,10 @@
                 proc.WaitForExit();
                 proc.CancelOutputRead();
                 AppendMessage("csc.exe returned " + proc.ExitCode);
+                if (proc.ExitCode != 0)
+                    throw new Exception($"csc.exe returned {proc.ExitCode}. This is most likely a build failure");
             }
+            */
         }
 
         private Process SetupProcess(string exe, string argsStr)
@@ -224,5 +292,14 @@
                 MessageBox.Show("Build completed. See readme.txt for further instructions");
             }
         }
+
+        private void btnSaveMessages_Click(object sender, EventArgs e)
+        {
+            using (var fp = new SaveFileDialog())
+            {
+                File.WriteAllText(fp.FileName, txtMessages.Text);
+                MessageBox.Show($"Messages saved to {fp.FileName}");
+            }
+        }
     }
 }
\ No newline at end of file

Modified: trunk/Tools/Maestro/ProviderTemplate/ProviderTemplate.csproj
===================================================================
--- trunk/Tools/Maestro/ProviderTemplate/ProviderTemplate.csproj	2015-09-21 04:22:58 UTC (rev 8760)
+++ trunk/Tools/Maestro/ProviderTemplate/ProviderTemplate.csproj	2015-09-22 15:52:57 UTC (rev 8761)
@@ -37,11 +37,27 @@
     <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="Microsoft.CodeAnalysis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\Maestro\packages\Microsoft.CodeAnalysis.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\Maestro\packages\Microsoft.CodeAnalysis.CSharp.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Collections.Immutable, Version=1.1.36.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\Maestro\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="System.Core" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
     <Reference Include="System.Drawing" />
+    <Reference Include="System.Reflection.Metadata, Version=1.0.21.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\Maestro\packages\System.Reflection.Metadata.1.0.21\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
   </ItemGroup>
@@ -93,6 +109,8 @@
     <None Include="Resources\AssemblyInfo.txt" />
   </ItemGroup>
   <ItemGroup>
+    <Analyzer Include="..\Maestro\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
+    <Analyzer Include="..\Maestro\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
     <Analyzer Include="..\Maestro\packages\RefactoringEssentials.1.2.0\analyzers\dotnet\RefactoringEssentials.dll" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Modified: trunk/Tools/Maestro/ProviderTemplate/packages.config
===================================================================
--- trunk/Tools/Maestro/ProviderTemplate/packages.config	2015-09-21 04:22:58 UTC (rev 8760)
+++ trunk/Tools/Maestro/ProviderTemplate/packages.config	2015-09-22 15:52:57 UTC (rev 8761)
@@ -1,4 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="Microsoft.CodeAnalysis.Analyzers" version="1.0.0" targetFramework="net45" />
+  <package id="Microsoft.CodeAnalysis.Common" version="1.0.0" targetFramework="net45" />
+  <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0" targetFramework="net45" />
   <package id="RefactoringEssentials" version="1.2.0" targetFramework="net45" />
+  <package id="System.Collections.Immutable" version="1.1.36" targetFramework="net45" />
+  <package id="System.Reflection.Metadata" version="1.0.21" targetFramework="net45" />
 </packages>
\ No newline at end of file



More information about the mapguide-commits mailing list