Draft
fix(solution): use ArgumentList for PAC CLI invocation to fix stray quote on --packagetype#1529
Conversation
… quote in --packagetype value Fixes #1528 Passing all PAC CLI arguments as individually-escaped values via ProcessStartInfo.ArgumentList (net8.0) and a proper Windows CommandLineToArgvW-compatible escaping helper (net462) instead of building a single manually-quoted argument string. The previous approach was fragile: a path ending with a backslash (e.g. `--folder "D:\folder\"`) causes Windows argument parsing to treat `\"` as an escaped quote, so the closing `"` for that argument is never seen and the subsequent `--packagetype Managed` token is consumed as part of the folder value. When the PAC CLI is a .cmd wrapper the quoting interaction can produce a stray trailing `"` on the `--packagetype` value (`Managed"`), causing the error shown in the bug report.
Copilot
AI
changed the title
[WIP] Fix Compress-DataverseSolutionFile argument value error
fix(solution): use ArgumentList for PAC CLI invocation to fix stray quote on --packagetype
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compress-DataverseSolutionFile -PackageType Managedfails because PAC CLI receivesManaged"(trailing quote) as the--packagetypevalue, causing an invalid-argument error.Root Cause
Arguments were built as a single manually-quoted string:
When
workingPathends with\, the sequence"D:\folder\"contains\"which Windows CommandLineToArgvW treats as an escaped quote — the closing"is never seen as a terminator, and--packagetype Managedis absorbed into the folder value. When PAC CLI is invoked through a.cmdwrapper this quoting interaction produces a stray"appended to the final token (Managed").Changes Made
PacCliHelper.ExecutePacCliWithOutputsignature changed to acceptstring[]of individual arguments instead of a pre-quoted string stringnet8.0: populatesProcessStartInfo.ArgumentList— the runtime handles all escapingnet462: builds a properly-escapedArgumentsstring viaEscapeWindowsArgument, which correctly doubles trailing backslashes before the closing"CompressDataverseSolutionFileCmdlet,ExpandDataverseSolutionFileCmdlet,ImportDataverseSolutionCmdlet,ExportDataverseSolutionCmdletupdated to pass individual unquoted argument tokensTesting
Checklist