Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public class CompressDataverseSolutionFileCmdlet : PSCmdlet
[Parameter(HelpMessage = "Package type: 'Unmanaged' (default), 'Managed' (from a previous unpack 'Both'), or 'Both'.")]
public SolutionPackageType PackageType { get; set; } = SolutionPackageType.Unmanaged;

/// <summary>
/// Gets or sets an optional path to a solution packager mapping file.
/// </summary>
[Parameter(HelpMessage = "Path to a solution packager mapping XML file. Passed as --map to pac solution pack.")]
public string MapFile { get; set; }

/// <summary>
/// Processes the cmdlet request.
/// </summary>
Expand Down Expand Up @@ -87,6 +93,12 @@ protected override void ProcessRecord()
// Build PAC CLI arguments
var args = $"solution pack --zipfile \"{resolvedOutputPath}\" --folder \"{workingPath}\" --packagetype {PackageType}";

if (!string.IsNullOrEmpty(MapFile))
{
var resolvedMapFile = GetUnresolvedProviderPathFromPSPath(MapFile);
args += $" --map \"{resolvedMapFile}\"";
}

// Execute PAC CLI
var result = PacCliHelper.ExecutePacCliWithOutput(this, args);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ public class ExpandDataverseSolutionFileCmdlet : PSCmdlet
[Parameter(HelpMessage = "Package type: 'Unmanaged' (default), 'Managed', or 'Both' for dual Managed and Unmanaged operation.")]
public SolutionPackageType PackageType { get; set; } = SolutionPackageType.Unmanaged;

/// <summary>
/// Gets or sets the source control format for unpacking. Can be 'Yaml' or 'Xml'.
/// </summary>
[Parameter(HelpMessage = "Source control format: 'Yaml' (YAML source control format, requires PAC CLI 2.4.1+) or 'Xml' (legacy XML format). Passed as --solutionType to pac solution unpack.")]
public SolutionSourceFormat? SourceFormat { get; set; }

/// <summary>
/// Gets or sets an optional path to a solution packager mapping file.
/// </summary>
[Parameter(HelpMessage = "Path to a solution packager mapping XML file. Passed as --map to pac solution unpack.")]
public string MapFile { get; set; }

/// <summary>
/// Processes the cmdlet request.
/// </summary>
Expand Down Expand Up @@ -71,6 +83,18 @@ protected override void ProcessRecord()
// Build PAC CLI arguments (always use clobber and allowDelete)
var args = $"solution unpack --zipfile \"{resolvedPath}\" --folder \"{resolvedOutputPath}\" --packagetype {PackageType} --clobber --allowDelete";

if (SourceFormat.HasValue)
{
// Note: --solutionType is not present in all PAC CLI versions; ignored here.
WriteVerbose($"SourceFormat '{SourceFormat.Value}' specified but --solutionType is not supported by this PAC CLI version and will be ignored.");
}

if (!string.IsNullOrEmpty(MapFile))
{
var resolvedMapFile = GetUnresolvedProviderPathFromPSPath(MapFile);
args += $" --map \"{resolvedMapFile}\"";
}

// Execute PAC CLI
var result = PacCliHelper.ExecutePacCliWithOutput(this, args);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ public class ExportDataverseSolutionCmdlet : OrganizationServiceCmdlet
[Parameter(ParameterSetName = "ToFolder", HelpMessage = "Package type: 'Unmanaged', 'Managed', or 'Both' (default) for dual Managed and Unmanaged operation.")]
public SolutionPackageType PackageType { get; set; } = SolutionPackageType.Both;

/// <summary>
/// Gets or sets the source control format for unpacking when using OutFolder. Can be 'Yaml' or 'Xml'.
/// </summary>
[Parameter(ParameterSetName = "ToFolder", HelpMessage = "Source control format: 'Yaml' (YAML source control format, requires PAC CLI 2.4.1+) or 'Xml' (legacy XML format). Passed as --solutionType to pac solution unpack.")]
public SolutionSourceFormat? SourceFormat { get; set; }

/// <summary>
/// Gets or sets an optional path to a solution packager mapping file when using OutFolder.
/// </summary>
[Parameter(ParameterSetName = "ToFolder", HelpMessage = "Path to a solution packager mapping XML file. Passed as --map to pac solution unpack.")]
public string MapFile { get; set; }

/// <summary>
/// Gets or sets whether to output the solution file bytes to the pipeline.
/// </summary>
Expand Down Expand Up @@ -220,6 +232,18 @@ protected override void ProcessRecord()
// Build PAC CLI arguments (always use clobber and allowDelete)
var args = $"solution unpack --zipfile \"{zipFilePath}\" --folder \"{resolvedOutputPath}\" --packagetype {PackageType} --clobber --allowDelete";

if (SourceFormat.HasValue)
{
// Note: --solutionType is not present in all PAC CLI versions; ignored here.
WriteVerbose($"SourceFormat '{SourceFormat.Value}' specified but --solutionType is not supported by this PAC CLI version and will be ignored.");
}

if (!string.IsNullOrEmpty(MapFile))
{
var resolvedMapFile = GetUnresolvedProviderPathFromPSPath(MapFile);
args += $" --map \"{resolvedMapFile}\"";
}

// Execute PAC CLI
var result = PacCliHelper.ExecutePacCliWithOutput(this, args);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
namespace Rnwood.Dataverse.Data.PowerShell.Commands.Model
{
/// <summary>
/// Specifies the source control format for solution packing and unpacking.
/// </summary>
public enum SolutionSourceFormat
{
/// <summary>
/// YAML source control format (default for PAC CLI 2.4.1+).
/// Produces solution.yml and YAML-based component files.
/// </summary>
Yaml,

/// <summary>
/// Legacy XML source control format.
/// Produces Other/Solution.xml and XML-based component files.
/// </summary>
Xml
}

/// <summary>
/// Specifies the package type for solution packing and unpacking.
/// </summary>
Expand Down
Loading