diff --git a/Build/Tasks/PackageAspNetMvc.cs b/Build/Tasks/PackageAspNetMvc.cs
index ee87eee81ce..fc334c5ff6a 100644
--- a/Build/Tasks/PackageAspNetMvc.cs
+++ b/Build/Tasks/PackageAspNetMvc.cs
@@ -1,69 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
-namespace DotNetNuke.Build.Tasks
-{
- using System;
- using System.Diagnostics;
- using System.Linq;
- using System.Xml;
-
- using Cake.Common.Diagnostics;
- using Cake.Common.IO;
- using Cake.Frosting;
- using Dnn.CakeUtils;
+namespace DotNetNuke.Build.Tasks;
- /// A cake task to generate the ASP.NET MVC package.
- public sealed class PackageAspNetMvc : FrostingTask
+/// A cake task to generate the ASP.NET MVC package.
+public sealed class PackageAspNetMvc : PackageComponentTask
+{
+ /// Initializes a new instance of the class.
+ public PackageAspNetMvc()
+ : base("AspNetMvc", "System.Web.Mvc.dll", "Microsoft.AspNetMvc")
{
- ///
- public override void Run(Context context)
- {
- var binDir = context.WebsiteDir.Path.Combine("bin");
- var mainAssemblyPath = binDir.CombineWithFilePath("System.Web.Mvc.dll");
- var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath);
-
- var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/AspNetMvc_{packageVersion}_Install.zip");
- var packageDir = context.Directory("DNN Platform/Components/Microsoft.AspNetMvc");
-
- context.Information($"Creating {packageZip}");
- context.Zip(
- packageDir.ToString(),
- packageZip,
- context.GetFilesByPatterns(packageDir, new[] { "*" }, new[] { "*.dnn" }));
-
- var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
- context.Information($"Reading manifest from {manifestPath}");
- var manifest = new XmlDocument();
- manifest.LoadXml(context.ReadFile(manifestPath));
- var assemblies =
- from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
- from XmlNode childNode in assemblyNode.ChildNodes
- where childNode.LocalName.Equals("name")
- select childNode;
-
- foreach (var assemblyNameNode in assemblies)
- {
- var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
- context.Information($"Adding {assemblyPath} to {packageZip}");
- context.AddFilesToZip(
- packageZip,
- context.MakeAbsolute(context.WebsiteDir.Path),
- context.GetFiles(assemblyPath.ToString()),
- append: true);
-
- var versionNode = assemblyNameNode.ParentNode.ChildNodes.Cast()
- .SingleOrDefault(childNode => childNode.LocalName.Equals("version"));
- if (versionNode != null)
- {
- versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
- context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
- }
- }
-
- manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion;
-
- context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
- }
}
}
diff --git a/Build/Tasks/PackageAspNetWebApi.cs b/Build/Tasks/PackageAspNetWebApi.cs
index 5610c21366c..04be9c488fd 100644
--- a/Build/Tasks/PackageAspNetWebApi.cs
+++ b/Build/Tasks/PackageAspNetWebApi.cs
@@ -1,69 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
-namespace DotNetNuke.Build.Tasks
-{
- using System;
- using System.Diagnostics;
- using System.Linq;
- using System.Xml;
-
- using Cake.Common.Diagnostics;
- using Cake.Common.IO;
- using Cake.Frosting;
- using Dnn.CakeUtils;
+namespace DotNetNuke.Build.Tasks;
- /// A cake task to generate the ASP.NET Web API package.
- public sealed class PackageAspNetWebApi : FrostingTask
+/// A cake task to generate the ASP.NET Web API package.
+public sealed class PackageAspNetWebApi : PackageComponentTask
+{
+ /// Initializes a new instance of the class.
+ public PackageAspNetWebApi()
+ : base("AspNetWebApi", "System.Web.Http.dll", "Microsoft.AspNetWebApi")
{
- ///
- public override void Run(Context context)
- {
- var binDir = context.WebsiteDir.Path.Combine("bin");
- var mainAssemblyPath = binDir.CombineWithFilePath("System.Web.Http.dll");
- var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath);
-
- var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/AspNetWebApi_{packageVersion}_Install.zip");
- var packageDir = context.Directory("DNN Platform/Components/Microsoft.AspNetWebApi");
-
- context.Information($"Creating {packageZip}");
- context.Zip(
- packageDir.ToString(),
- packageZip,
- context.GetFilesByPatterns(packageDir, new[] { "*" }, new[] { "*.dnn" }));
-
- var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
- context.Information($"Reading manifest from {manifestPath}");
- var manifest = new XmlDocument();
- manifest.LoadXml(context.ReadFile(manifestPath));
- var assemblies =
- from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
- from XmlNode childNode in assemblyNode.ChildNodes
- where childNode.LocalName.Equals("name")
- select childNode;
-
- foreach (var assemblyNameNode in assemblies)
- {
- var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
- context.Information($"Adding {assemblyPath} to {packageZip}");
- context.AddFilesToZip(
- packageZip,
- context.MakeAbsolute(context.WebsiteDir.Path),
- context.GetFiles(assemblyPath.ToString()),
- append: true);
-
- var versionNode = assemblyNameNode.ParentNode.ChildNodes.Cast()
- .SingleOrDefault(childNode => childNode.LocalName.Equals("version"));
- if (versionNode != null)
- {
- versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
- context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
- }
- }
-
- manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion;
-
- context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
- }
}
}
diff --git a/Build/Tasks/PackageAspNetWebPages.cs b/Build/Tasks/PackageAspNetWebPages.cs
index b4fe45a4097..e36d499330a 100644
--- a/Build/Tasks/PackageAspNetWebPages.cs
+++ b/Build/Tasks/PackageAspNetWebPages.cs
@@ -1,69 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
-namespace DotNetNuke.Build.Tasks
-{
- using System;
- using System.Diagnostics;
- using System.Linq;
- using System.Xml;
-
- using Cake.Common.Diagnostics;
- using Cake.Common.IO;
- using Cake.Frosting;
- using Dnn.CakeUtils;
+namespace DotNetNuke.Build.Tasks;
- /// A cake task to generate the ASP.NET Web Pages package.
- public sealed class PackageAspNetWebPages : FrostingTask
+/// A cake task to generate the ASP.NET Web Pages package.
+public sealed class PackageAspNetWebPages : PackageComponentTask
+{
+ /// Initializes a new instance of the class.
+ public PackageAspNetWebPages()
+ : base("AspNetWebPages", "System.Web.WebPages.dll", "Microsoft.AspNetWebPages")
{
- ///
- public override void Run(Context context)
- {
- var binDir = context.WebsiteDir.Path.Combine("bin");
- var mainAssemblyPath = binDir.CombineWithFilePath("System.Web.WebPages.dll");
- var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath);
-
- var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/AspNetWebPages_{packageVersion}_Install.zip");
- var packageDir = context.Directory("DNN Platform/Components/Microsoft.AspNetWebPages");
-
- context.Information($"Creating {packageZip}");
- context.Zip(
- packageDir.ToString(),
- packageZip,
- context.GetFilesByPatterns(packageDir, new[] { "*" }, new[] { "*.dnn" }));
-
- var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
- context.Information($"Reading manifest from {manifestPath}");
- var manifest = new XmlDocument();
- manifest.LoadXml(context.ReadFile(manifestPath));
- var assemblies =
- from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
- from XmlNode childNode in assemblyNode.ChildNodes
- where childNode.LocalName.Equals("name")
- select childNode;
-
- foreach (var assemblyNameNode in assemblies)
- {
- var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
- context.Information($"Adding {assemblyPath} to {packageZip}");
- context.AddFilesToZip(
- packageZip,
- context.MakeAbsolute(context.WebsiteDir.Path),
- context.GetFiles(assemblyPath.ToString()),
- append: true);
-
- var versionNode = assemblyNameNode.ParentNode.ChildNodes.Cast()
- .SingleOrDefault(childNode => childNode.LocalName.Equals("version"));
- if (versionNode != null)
- {
- versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
- context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
- }
- }
-
- manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion;
-
- context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
- }
}
}
diff --git a/Build/Tasks/PackageComponentTask.cs b/Build/Tasks/PackageComponentTask.cs
new file mode 100644
index 00000000000..788f96b1a70
--- /dev/null
+++ b/Build/Tasks/PackageComponentTask.cs
@@ -0,0 +1,87 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information
+
+namespace DotNetNuke.Build.Tasks;
+
+using System.Linq;
+using System.Xml;
+using Cake.Common.Diagnostics;
+using Cake.Common.IO;
+using Cake.Core.IO;
+using Cake.Frosting;
+using Dnn.CakeUtils;
+
+/// Provides the base functionality for packaging a folder inside Components.
+public abstract class PackageComponentTask : FrostingTask
+{
+ /// Initializes a new instance of the class.
+ /// The name of the component.
+ /// The name of the primary assembly.
+ /// The name of the folder in DNN Platform/Components/.
+ protected PackageComponentTask(string componentName, FilePath primaryAssemblyName = null, DirectoryPath componentFolderName = null)
+ {
+ this.ComponentName = componentName;
+ this.ComponentFolderName = componentFolderName ?? componentName;
+ this.PrimaryAssemblyName = primaryAssemblyName ?? $"{componentName}.dll";
+ }
+
+ /// Gets the name of the component.
+ public string ComponentName { get; }
+
+ /// Gets the name of the folder in DNN Platform/Components/ where the component files are.
+ public DirectoryPath ComponentFolderName { get; }
+
+ /// Gets the name of the primary assembly.
+ public FilePath PrimaryAssemblyName { get; }
+
+ ///
+ public override void Run(Context context)
+ {
+ var binDir = context.WebsiteDir.Path.Combine("bin");
+ var mainAssemblyPath = binDir.CombineWithFilePath(this.PrimaryAssemblyName);
+ var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath);
+
+ var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/{this.ComponentName}_{packageVersion}_Install.zip");
+ var packageDir = context.Directory($"DNN Platform/Components/{this.ComponentFolderName}");
+
+ context.Information($"Creating {packageZip}");
+ context.Zip(
+ packageDir.ToString(),
+ packageZip,
+ context.GetFilesByPatterns(packageDir, new[] { "*" }, new[] { "*.dnn" }));
+
+ var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
+ context.Information($"Reading manifest from {manifestPath}");
+ var manifest = new XmlDocument();
+ manifest.LoadXml(context.ReadFile(manifestPath));
+ var assemblies =
+ from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
+ from XmlNode childNode in assemblyNode.ChildNodes
+ where childNode.LocalName.Equals("name")
+ select childNode;
+
+ foreach (var assemblyNameNode in assemblies)
+ {
+ var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
+ context.Information($"Adding {assemblyPath} to {packageZip}");
+ context.AddFilesToZip(
+ packageZip,
+ context.MakeAbsolute(context.WebsiteDir.Path),
+ context.GetFiles(assemblyPath.ToString()),
+ append: true);
+
+ var versionNode = assemblyNameNode.ParentNode?.ChildNodes.Cast()
+ .SingleOrDefault(childNode => childNode.LocalName.Equals("version"));
+ if (versionNode != null)
+ {
+ versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
+ context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
+ }
+ }
+
+ manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion;
+
+ context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
+ }
+}
diff --git a/Build/Tasks/PackageMailKit.cs b/Build/Tasks/PackageMailKit.cs
index 80138e7f775..b434707156e 100644
--- a/Build/Tasks/PackageMailKit.cs
+++ b/Build/Tasks/PackageMailKit.cs
@@ -1,69 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
-namespace DotNetNuke.Build.Tasks
-{
- using System;
- using System.Diagnostics;
- using System.Linq;
- using System.Xml;
-
- using Cake.Common.Diagnostics;
- using Cake.Common.IO;
- using Cake.Frosting;
- using Dnn.CakeUtils;
+namespace DotNetNuke.Build.Tasks;
- /// A cake task to generate the MailKit package.
- public sealed class PackageMailKit : FrostingTask
+/// A cake task to generate the MailKit package.
+public sealed class PackageMailKit : PackageComponentTask
+{
+ /// Initializes a new instance of the class.
+ public PackageMailKit()
+ : base("MailKit")
{
- ///
- public override void Run(Context context)
- {
- var binDir = context.WebsiteDir.Path.Combine("bin");
- var mailKitPath = binDir.CombineWithFilePath("MailKit.dll");
- var packageVersion = context.GetAssemblyFileVersion(mailKitPath);
-
- var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/MailKit_{packageVersion}_Install.zip");
- var packageDir = context.Directory("DNN Platform/Components/MailKit");
-
- context.Information($"Creating {packageZip}");
- context.Zip(
- packageDir.ToString(),
- packageZip,
- context.GetFilesByPatterns(packageDir, new[] { "*" }, new[] { "*.dnn" }));
-
- var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
- context.Information($"Reading manifest from {manifestPath}");
- var manifest = new XmlDocument();
- manifest.LoadXml(context.ReadFile(manifestPath));
- var assemblies =
- from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
- from XmlNode childNode in assemblyNode.ChildNodes
- where childNode.LocalName.Equals("name")
- select childNode;
-
- foreach (var assemblyNameNode in assemblies)
- {
- var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
- context.Information($"Adding {assemblyPath} to {packageZip}");
- context.AddFilesToZip(
- packageZip,
- context.MakeAbsolute(context.WebsiteDir.Path),
- context.GetFiles(assemblyPath.ToString()),
- append: true);
-
- var versionNode = assemblyNameNode.ParentNode.ChildNodes.Cast()
- .SingleOrDefault(childNode => childNode.LocalName.Equals("version"));
- if (versionNode != null)
- {
- versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
- context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
- }
- }
-
- manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion;
-
- context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
- }
}
}
diff --git a/Build/Tasks/PackageMicrosoftGlobbing.cs b/Build/Tasks/PackageMicrosoftGlobbing.cs
index f155f45bf72..bf4cf5a01f6 100644
--- a/Build/Tasks/PackageMicrosoftGlobbing.cs
+++ b/Build/Tasks/PackageMicrosoftGlobbing.cs
@@ -1,68 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
-namespace DotNetNuke.Build.Tasks
-{
- using System.Diagnostics;
- using System.Linq;
- using System.Xml;
-
- using Cake.Common.Diagnostics;
- using Cake.Common.IO;
- using Cake.Frosting;
- using Dnn.CakeUtils;
+namespace DotNetNuke.Build.Tasks;
- /// A cake task to generate the Microsoft.Extensions.FileSystemGlobbing package.
- public sealed class PackageMicrosoftGlobbing : FrostingTask
+/// A cake task to generate the Microsoft.Extensions.FileSystemGlobbing package.
+public sealed class PackageMicrosoftGlobbing : PackageComponentTask
+{
+ /// Initializes a new instance of the class.
+ public PackageMicrosoftGlobbing()
+ : base("MicrosoftGlobbing", "Microsoft.Extensions.FileSystemGlobbing.dll", "Microsoft.Extensions.FileSystemGlobbing")
{
- ///
- public override void Run(Context context)
- {
- var binDir = context.WebsiteDir.Path.Combine("bin");
- var mainAssemblyPath = binDir.CombineWithFilePath("Microsoft.Extensions.FileSystemGlobbing.dll");
- var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath);
-
- var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/MicrosoftGlobbing_{packageVersion}_Install.zip");
- var packageDir = context.Directory("DNN Platform/Components/Microsoft.Extensions.FileSystemGlobbing");
-
- context.Information($"Creating {packageZip}");
- context.Zip(
- packageDir.ToString(),
- packageZip,
- context.GetFilesByPatterns(packageDir, new[] { "*" }, new[] { "*.dnn" }));
-
- var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
- context.Information($"Reading manifest from {manifestPath}");
- var manifest = new XmlDocument();
- manifest.LoadXml(context.ReadFile(manifestPath));
- var assemblies =
- from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
- from XmlNode childNode in assemblyNode.ChildNodes
- where childNode.LocalName.Equals("name")
- select childNode;
-
- foreach (var assemblyNameNode in assemblies)
- {
- var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
- context.Information($"Adding {assemblyPath} to {packageZip}");
- context.AddFilesToZip(
- packageZip,
- context.MakeAbsolute(context.WebsiteDir.Path),
- context.GetFiles(assemblyPath.ToString()),
- append: true);
-
- var versionNode = assemblyNameNode.ParentNode.ChildNodes.Cast()
- .SingleOrDefault(childNode => childNode.LocalName.Equals("version"));
- if (versionNode != null)
- {
- versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
- context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
- }
- }
-
- manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion;
-
- context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
- }
}
}
diff --git a/Build/Tasks/PackageNewtonsoft.cs b/Build/Tasks/PackageNewtonsoft.cs
index 0d4c0e9b2d6..11b60f5aaf0 100644
--- a/Build/Tasks/PackageNewtonsoft.cs
+++ b/Build/Tasks/PackageNewtonsoft.cs
@@ -1,35 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
-namespace DotNetNuke.Build.Tasks
-{
- using Cake.Common.IO;
- using Cake.Frosting;
-
- using Dnn.CakeUtils;
+namespace DotNetNuke.Build.Tasks;
- /// A cake task to generate the Newtonsoft.Json package.
- public sealed class PackageNewtonsoft : FrostingTask
+/// A cake task to generate the Newtonsoft.Json package.
+public sealed class PackageNewtonsoft : PackageComponentTask
+{
+ /// Initializes a new instance of the class.
+ public PackageNewtonsoft()
+ : base("Newtonsoft.Json", "Newtonsoft.Json.dll", "Newtonsoft")
{
- ///
- public override void Run(Context context)
- {
- var version = "00.00.00";
- foreach (var assemblyPath in context.GetFiles(context.WebsiteFolder + "bin/Newtonsoft.Json.dll"))
- {
- version = context.GetAssemblyFileVersion(assemblyPath);
- }
-
- var packageZip = $"{context.WebsiteFolder}Install/Module/Newtonsoft.Json_{version}_Install.zip";
- context.Zip(
- "./DNN Platform/Components/Newtonsoft",
- packageZip,
- context.GetFiles("./DNN Platform/Components/Newtonsoft/*"));
- context.AddFilesToZip(
- packageZip,
- "Website",
- context.GetFiles(context.WebsiteFolder + "bin/Newtonsoft.Json.dll"),
- true);
- }
}
}
diff --git a/Build/Tasks/PackageSharpZipLib.cs b/Build/Tasks/PackageSharpZipLib.cs
index 952f6d779ab..6b9bd3dfa33 100644
--- a/Build/Tasks/PackageSharpZipLib.cs
+++ b/Build/Tasks/PackageSharpZipLib.cs
@@ -1,67 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
-namespace DotNetNuke.Build.Tasks
-{
- using System.Linq;
- using System.Xml;
-
- using Cake.Common.Diagnostics;
- using Cake.Common.IO;
- using Cake.Frosting;
- using Dnn.CakeUtils;
+namespace DotNetNuke.Build.Tasks;
- /// A cake task to generate the SharpZipLib package.
- public sealed class PackageSharpZipLib : FrostingTask
+/// A cake task to generate the SharpZipLib package.
+public sealed class PackageSharpZipLib : PackageComponentTask
+{
+ /// Initializes a new instance of the class.
+ public PackageSharpZipLib()
+ : base("SharpZipLib", "ICSharpCode.SharpZipLib.dll")
{
- ///
- public override void Run(Context context)
- {
- var binDir = context.WebsiteDir.Path.Combine("bin");
- var mainAssemblyPath = binDir.CombineWithFilePath("ICSharpCode.SharpZipLib.dll");
- var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath);
-
- var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/SharpZipLib_{packageVersion}_Install.zip");
- var packageDir = context.Directory("DNN Platform/Components/SharpZipLib");
-
- context.Information($"Creating {packageZip}");
- context.Zip(
- packageDir.ToString(),
- packageZip,
- context.GetFilesByPatterns(packageDir, new[] { "*" }, new[] { "*.dnn" }));
-
- var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
- context.Information($"Reading manifest from {manifestPath}");
- var manifest = new XmlDocument();
- manifest.LoadXml(context.ReadFile(manifestPath));
- var assemblies =
- from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
- from XmlNode childNode in assemblyNode.ChildNodes
- where childNode.LocalName.Equals("name")
- select childNode;
-
- foreach (var assemblyNameNode in assemblies)
- {
- var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
- context.Information($"Adding {assemblyPath} to {packageZip}");
- context.AddFilesToZip(
- packageZip,
- context.MakeAbsolute(context.WebsiteDir.Path),
- context.GetFiles(assemblyPath.ToString()),
- append: true);
-
- var versionNode = assemblyNameNode.ParentNode.ChildNodes.Cast()
- .SingleOrDefault(childNode => childNode.LocalName.Equals("version"));
- if (versionNode != null)
- {
- versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
- context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
- }
- }
-
- manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion;
-
- context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
- }
}
}
diff --git a/Build/Tasks/PackageWebFormsMvp.cs b/Build/Tasks/PackageWebFormsMvp.cs
index ff6b7487f61..af073bcc89a 100644
--- a/Build/Tasks/PackageWebFormsMvp.cs
+++ b/Build/Tasks/PackageWebFormsMvp.cs
@@ -1,68 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
-namespace DotNetNuke.Build.Tasks
-{
- using System.Diagnostics;
- using System.Linq;
- using System.Xml;
-
- using Cake.Common.Diagnostics;
- using Cake.Common.IO;
- using Cake.Frosting;
- using Dnn.CakeUtils;
+namespace DotNetNuke.Build.Tasks;
- /// A cake task to generate the WebFormsMvp package.
- public sealed class PackageWebFormsMvp : FrostingTask
+/// A cake task to generate the WebFormsMvp package.
+public sealed class PackageWebFormsMvp : PackageComponentTask
+{
+ /// Initializes a new instance of the class.
+ public PackageWebFormsMvp()
+ : base("WebFormsMvp")
{
- ///
- public override void Run(Context context)
- {
- var binDir = context.WebsiteDir.Path.Combine("bin");
- var mainAssemblyPath = binDir.CombineWithFilePath("WebFormsMvp.dll");
- var packageVersion = context.GetAssemblyFileVersion(mainAssemblyPath);
-
- var packageZip = context.WebsiteDir.Path.CombineWithFilePath($"Install/Library/WebFormsMvp_{packageVersion}_Install.zip");
- var packageDir = context.Directory("DNN Platform/Components/WebFormsMvp");
-
- context.Information($"Creating {packageZip}");
- context.Zip(
- packageDir.ToString(),
- packageZip,
- context.GetFilesByPatterns(packageDir, new[] { "*" }, new[] { "*.dnn" }));
-
- var manifestPath = context.GetFiles(packageDir.Path.CombineWithFilePath("*.dnn").ToString()).Single();
- context.Information($"Reading manifest from {manifestPath}");
- var manifest = new XmlDocument();
- manifest.LoadXml(context.ReadFile(manifestPath));
- var assemblies =
- from XmlNode assemblyNode in manifest.SelectNodes("//assembly")
- from XmlNode childNode in assemblyNode.ChildNodes
- where childNode.LocalName.Equals("name")
- select childNode;
-
- foreach (var assemblyNameNode in assemblies)
- {
- var assemblyPath = binDir.CombineWithFilePath(assemblyNameNode.InnerText);
- context.Information($"Adding {assemblyPath} to {packageZip}");
- context.AddFilesToZip(
- packageZip,
- context.MakeAbsolute(context.WebsiteDir.Path),
- context.GetFiles(assemblyPath.ToString()),
- append: true);
-
- var versionNode = assemblyNameNode.ParentNode.ChildNodes.Cast()
- .SingleOrDefault(childNode => childNode.LocalName.Equals("version"));
- if (versionNode != null)
- {
- versionNode.InnerText = context.GetAssemblyFileVersion(assemblyPath);
- context.Information($"Set {assemblyPath} version to {versionNode.InnerText}");
- }
- }
-
- manifest.SelectSingleNode("//package[@version]").Attributes["version"].Value = packageVersion;
-
- context.AddXmlFileToZip(packageZip, manifest, manifestPath.GetFilename().ToString(), append: true);
- }
}
}