Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

PowerApp build tools: "Build Managed Solution" Pipeline failing on Task "Power platform Pack solution. SolutionPackager.exe return error code 2

(0) ShareShare
ReportReport
Posted on by

Hi all,

I am getting following error and not sure what is the exact cause here, i wonder if somebody could help here please?

2020-06-10T10:43:44.4583733Z ##[debug]Evaluating condition for step: 'Power Platform Pack Solution '
2020-06-10T10:43:44.4586113Z ##[debug]Evaluating: succeeded()
2020-06-10T10:43:44.4586696Z ##[debug]Evaluating succeeded:
2020-06-10T10:43:44.4588140Z ##[debug]=> True
2020-06-10T10:43:44.4588740Z ##[debug]Result: True
2020-06-10T10:43:44.4589405Z ##[section]Starting: Power Platform Pack Solution
2020-06-10T10:43:44.4749879Z ==============================================================================
2020-06-10T10:43:44.4750888Z Task : Power Platform Pack Solution
2020-06-10T10:43:44.4751575Z Description : Power Platform Pack Solution
2020-06-10T10:43:44.4751842Z Version : 0.0.1
2020-06-10T10:43:44.4752060Z Author : Microsoft
2020-06-10T10:43:44.4752366Z Help : More Info
2020-06-10T10:43:44.4752708Z ==============================================================================
2020-06-10T10:43:45.4127390Z ##[debug]VstsTaskSdk 0.11.0 commit 7ff27a3e0bdd6f7b06690ae5f5b63cb84d0f23f4
2020-06-10T10:43:45.5434183Z ##[debug]Entering D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\PackSolution.ps1.
2020-06-10T10:43:45.5599612Z ##[debug]Loading module from path 'D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\SharedFunctions.psm1'.
2020-06-10T10:43:45.6138066Z ##[debug]Exporting function 'Get-ServiceConnection'.
2020-06-10T10:43:45.6172013Z ##[debug]Exporting function 'Get-PSCredentialFromServiceConnection'.
2020-06-10T10:43:45.6215294Z ##[debug]Exporting function 'Get-SpnInfoServiceConnection'.
2020-06-10T10:43:45.6250246Z ##[debug]Exporting function 'Get-AuthInfoFromActiveServiceConnection'.
2020-06-10T10:43:45.6285375Z ##[debug]Exporting function 'Add-BapAdminConnection'.
2020-06-10T10:43:45.6325222Z ##[debug]Exporting function 'Get-UrlFromEnvironmentVariables'.
2020-06-10T10:43:45.6373020Z ##[debug]Exporting function 'Set-EnvironmentUrl'.
2020-06-10T10:43:45.6415063Z ##[debug]Exporting function 'Get-VstsInputWithDefault'.
2020-06-10T10:43:45.6446397Z ##[debug]Exporting function 'Get-TaskInputProperties'.
2020-06-10T10:43:45.6476578Z ##[debug]Exporting function 'Wait-CrmOperation'.
2020-06-10T10:43:45.6509870Z ##[debug]Exporting function 'Wait-EnvironmentAvailability'.
2020-06-10T10:43:45.6546281Z ##[debug]Exporting function 'Get-DomainNameFromUrl'.
2020-06-10T10:43:45.6577458Z ##[debug]Exporting function 'Import-PowerPlatformToolsPowerShellModule'.
2020-06-10T10:43:45.6617430Z ##[debug]Exporting function 'Get-BindingRedirector'.
2020-06-10T10:43:45.6651627Z ##[debug]Exporting function 'Get-OutputDirectory'.
2020-06-10T10:43:45.6683518Z ##[debug]Exporting function 'Disable-AdminMode'.
2020-06-10T10:43:45.6717004Z ##[debug]Importing function 'Add-BapAdminConnection'.
2020-06-10T10:43:45.6751491Z ##[debug]Importing function 'Disable-AdminMode'.
2020-06-10T10:43:45.6787442Z ##[debug]Importing function 'Get-AuthInfoFromActiveServiceConnection'.
2020-06-10T10:43:45.6822077Z ##[debug]Importing function 'Get-BindingRedirector'.
2020-06-10T10:43:45.6850700Z ##[debug]Importing function 'Get-DomainNameFromUrl'.
2020-06-10T10:43:45.6885949Z ##[debug]Importing function 'Get-OutputDirectory'.
2020-06-10T10:43:45.6916882Z ##[debug]Importing function 'Get-PSCredentialFromServiceConnection'.
2020-06-10T10:43:45.6949607Z ##[debug]Importing function 'Get-ServiceConnection'.
2020-06-10T10:43:45.6982267Z ##[debug]Importing function 'Get-SpnInfoServiceConnection'.
2020-06-10T10:43:45.7013613Z ##[debug]Importing function 'Get-TaskInputProperties'.
2020-06-10T10:43:45.7049629Z ##[debug]Importing function 'Get-UrlFromEnvironmentVariables'.
2020-06-10T10:43:45.7081510Z ##[debug]Importing function 'Get-VstsInputWithDefault'.
2020-06-10T10:43:45.7128642Z ##[debug]Importing function 'Import-PowerPlatformToolsPowerShellModule'.
2020-06-10T10:43:45.8294192Z ##[debug]Importing function 'Set-EnvironmentUrl'.
2020-06-10T10:43:45.8294922Z ##[debug]Importing function 'Wait-CrmOperation'.
2020-06-10T10:43:45.8295563Z ##[debug]Importing function 'Wait-EnvironmentAvailability'.
2020-06-10T10:43:45.8299059Z ##[debug]Loading module from path 'D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\Get-ParameterValue.ps1'.
2020-06-10T10:43:45.8300585Z ##[debug]Dot-sourcing the script file 'D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\Get-ParameterValue.ps1'.
2020-06-10T10:43:45.8364343Z ##[debug]Loading module from path 'D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\SolutionPackager.psm1'.
2020-06-10T10:43:45.8508885Z ##[debug]Exporting function 'Get-InstalledNuGetPackageRootPath'.
2020-06-10T10:43:45.8541445Z ##[debug]Exporting function 'Invoke-SolutionPackager'.
2020-06-10T10:43:45.8582839Z ##[debug]Importing function 'Get-InstalledNuGetPackageRootPath'.
2020-06-10T10:43:45.8629703Z ##[debug]Importing function 'Invoke-SolutionPackager'.
2020-06-10T10:43:45.9251620Z ##[debug]INPUT_SOLUTIONSOURCEFOLDER: 'D:\a\1\s\FlowSolutionTest'
2020-06-10T10:43:45.9350759Z ##[debug]INPUT_SOLUTIONOUTPUTFILE: 'D:\a\1\s\Solution Output File: D:\a\1\a\FlowSolutionTest.zip'
2020-06-10T10:43:45.9441855Z ##[debug]INPUT_SOLUTIONTYPE: 'Unmanaged'
2020-06-10T10:43:45.9759227Z ##[debug]Get-Var: action = Pack
2020-06-10T10:43:45.9835840Z ##[debug]BoundParams: action = Pack
2020-06-10T10:43:45.9893994Z ##[debug]Get-Var: zipfile = D:\a\1\s\Solution Output File: D:\a\1\a\FlowSolutionTest.zip
2020-06-10T10:43:45.9936646Z ##[debug]BoundParams: zipfile = D:\a\1\s\Solution Output File: D:\a\1\a\FlowSolutionTest.zip
2020-06-10T10:43:45.9978689Z ##[debug]Get-Var: folder = D:\a\1\s\FlowSolutionTest
2020-06-10T10:43:46.0010713Z ##[debug]BoundParams: folder = D:\a\1\s\FlowSolutionTest
2020-06-10T10:43:46.0052575Z ##[debug]Get-Var: packagetype = Unmanaged
2020-06-10T10:43:46.0090150Z ##[debug]BoundParams: packagetype = Unmanaged
2020-06-10T10:43:46.0126216Z ##[debug]Get-Var: allowDelete = Yes
2020-06-10T10:43:46.0162291Z ##[debug]Get-Var: allowWrite = Yes
2020-06-10T10:43:46.0466734Z ##[debug]Attempting to get env variable: Env:\PowerPlatformTools_Microsoft_CrmSdk_CoreTools)
2020-06-10T10:43:46.0512825Z ##[debug]NuGet Package Root Path: D:\a\1_t\PA_BT\Microsoft.CrmSdk.CoreTools.9.1.0.39
2020-06-10T10:43:46.0655319Z ##[debug]SolutionPackager.exe found: D:\a\1_t\PA_BT\Microsoft.CrmSdk.CoreTools.9.1.0.39\content\bin\coretools\SolutionPackager.exe
2020-06-10T10:43:46.0892786Z ##[command]"D:\a\1_t\PA_BT\Microsoft.CrmSdk.CoreTools.9.1.0.39\content\bin\coretools\SolutionPackager.exe" /allowDelete:Yes /action:Pack /zipFile:D:\a\1\s\Solution Output File: D:\a\1\a\FlowSolutionTest.zip /allowWrite:Yes /folder:D:\a\1\s\FlowSolutionTest /packagetype:Unmanaged
2020-06-10T10:43:46.1728126Z SolutionPackger CRM Solution Packaging Tool [Version 9.1.0.42]
2020-06-10T10:43:46.1748134Z © 2017 Microsoft Corporation. All rights reserved
2020-06-10T10:43:46.1751047Z
2020-06-10T10:43:46.1856833Z Unrecognized command line argument 'Output'
2020-06-10T10:43:46.1857219Z Unrecognized command line argument 'File:'
2020-06-10T10:43:46.1857804Z Unrecognized command line argument 'D:\a\1\a\FlowSolutionTest.zip'
2020-06-10T10:43:46.1861346Z
2020-06-10T10:43:46.1898094Z Options:
2020-06-10T10:43:46.2068879Z /action:{Extract|Pack} Action to Perform (short form
2020-06-10T10:43:46.2082841Z /a)
2020-06-10T10:43:46.2101177Z /zipfile: The full path to the
2020-06-10T10:43:46.2115036Z customization ZIP file:
2020-06-10T10:43:46.2129672Z C:\customization.zip (short
2020-06-10T10:43:46.2144577Z form /z)
2020-06-10T10:43:46.2159797Z /packagetype:{Unmanaged|Managed|Both} When Extracting use to specify
2020-06-10T10:43:46.2176246Z dual Managed and Unmanaged
2020-06-10T10:43:46.2191652Z operation. When Packing use to
2020-06-10T10:43:46.2205610Z specify Managed or Unmanaged
2020-06-10T10:43:46.2222537Z from a previous 'Extract Both'.
2020-06-10T10:43:46.2236473Z (short form /p)
2020-06-10T10:43:46.2251616Z /folder: The path to the root folder:
2020-06-10T10:43:46.2265475Z C:\Solutions\Solution1. When
2020-06-10T10:43:46.2281219Z Extracting this will be written
2020-06-10T10:43:46.2295022Z to, when Packing this will be
2020-06-10T10:43:46.2320885Z read from. Default value:'.'
2020-06-10T10:43:46.2399040Z (short form /f)
2020-06-10T10:43:46.2416184Z /log: The path to the log file.
2020-06-10T10:43:46.2435145Z (short form /l)
2020-06-10T10:43:46.2450732Z /errorlevel:{Off|Error|Warning|Info|Verbose} Minimum logging level for log
2020-06-10T10:43:46.2472072Z output
2020-06-10T10:43:46.2504738Z [Verbose|Info|Warning|Error|Off]
2020-06-10T10:43:46.2518111Z . Default value:'Info' (short
2020-06-10T10:43:46.2535754Z form /e)
2020-06-10T10:43:46.2555143Z
2020-06-10T10:43:46.2571379Z /allowDelete:{Yes|No|Prompt} Dictates if delete operations
2020-06-10T10:43:46.2589099Z may occur. Default
2020-06-10T10:43:46.2604228Z value:'Prompt' (short form /ad)
2020-06-10T10:43:46.2619543Z /allowWrite:{Yes|No} Dictates if write operations
2020-06-10T10:43:46.2634480Z may occur. Default value:'Yes'
2020-06-10T10:43:46.2650279Z (short form /aw)
2020-06-10T10:43:46.2665642Z /clobber Enables that files marked
2020-06-10T10:43:46.2681647Z read-only can be deleted or
2020-06-10T10:43:46.2699273Z overwritten. (short form /c)
2020-06-10T10:43:46.2716477Z /map: The full path to a mapping xml
2020-06-10T10:43:46.2730245Z file: C:\maps.xml (short form
2020-06-10T10:43:46.2747201Z /m)
2020-06-10T10:43:46.2762046Z /nologo Suppresses the banner. (short
2020-06-10T10:43:46.2778050Z form /n)
2020-06-10T10:43:46.2793945Z /sourceLoc: Generates a template resource
2020-06-10T10:43:46.2811443Z file. Valid only on Extract.
2020-06-10T10:43:46.2828555Z Possible Values are auto or an
2020-06-10T10:43:46.2848811Z LCID/ISO code of the language
2020-06-10T10:43:46.2865018Z you wish to export. When
2020-06-10T10:43:46.2873860Z Present, this will extract the
2020-06-10T10:43:46.2887789Z string resources from the given
2020-06-10T10:43:46.2903301Z locale as a neutral .resx. If
2020-06-10T10:43:46.2916937Z auto or just the long or short
2020-06-10T10:43:46.2932374Z form of the switch is specified
2020-06-10T10:43:46.2948402Z the base locale for the
2020-06-10T10:43:46.2964126Z solution will be used. (short
2020-06-10T10:43:46.2981047Z form /src)
2020-06-10T10:43:46.2998566Z /localize Extract or merge all string
2020-06-10T10:43:46.3013156Z resources into .resx files.
2020-06-10T10:43:46.3028545Z (short form /loc)
2020-06-10T10:43:46.3043865Z
2020-06-10T10:43:46.3058242Z
2020-06-10T10:43:46.3073061Z /useUnmanagedFileForMissingManaged Use the same XML source file
2020-06-10T10:43:46.3088059Z when packaging for Managed and
2020-06-10T10:43:46.3103399Z only Unmanaged XML file is
2020-06-10T10:43:46.3118125Z found; applies to
2020-06-10T10:43:46.3133686Z AppModuleSiteMap, AppModuleMap,
2020-06-10T10:43:46.3147925Z FormXml files (short form /same)
2020-06-10T10:43:46.3164018Z @ Read response file for more
2020-06-10T10:43:46.3179155Z options
2020-06-10T10:43:46.3181283Z
2020-06-10T10:43:46.3196441Z SolutionPackager: CommandLineException thrown: Microsoft.Crm.Tools.SolutionPackager.CommandLineException: Exception of type 'Microsoft.Crm.Tools.SolutionPackager.CommandLineException' was thrown.
2020-06-10T10:43:46.3211450Z at Microsoft.Crm.Tools.SolutionPackager.Program.ParseCommandLine(String[] args)
2020-06-10T10:43:46.3225600Z at Microsoft.Crm.Tools.SolutionPackager.Program.Main(String[] args), returning error code '2'
2020-06-10T10:43:46.3261770Z ##[debug]Exit code: 2
2020-06-10T10:43:46.4178808Z ##[debug]Leaving D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\PackSolution.ps1.
2020-06-10T10:43:46.4253151Z ##[debug]Caught exception from task script.
2020-06-10T10:43:46.4305788Z ##[debug]Error record:
2020-06-10T10:43:46.4911772Z ##[debug]Invoke-SolutionPackager : SolutionPackager failed: 2
2020-06-10T10:43:46.4935139Z ##[debug]At D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\PackSolution.ps1:26 char:9
2020-06-10T10:43:46.4954929Z ##[debug]+ Invoke-SolutionPackager @SolutionPackagerParms
2020-06-10T10:43:46.4975485Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-06-10T10:43:46.4999051Z ##[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
2020-06-10T10:43:46.5021022Z ##[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-SolutionPackager
2020-06-10T10:43:46.5043946Z ##[debug]
2020-06-10T10:43:46.5074257Z ##[debug]Script stack trace:
2020-06-10T10:43:46.5136508Z ##[debug]at Invoke-SolutionPackager, D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\SolutionPackager.psm1: line 71
2020-06-10T10:43:46.5186402Z ##[debug]at Invoke-PackSolution, D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\PackSolution.ps1: line 26
2020-06-10T10:43:46.5215445Z ##[debug]at , D:\a_tasks\PowerPlatformPackSolution_769929ed-e421-451b-8255-21a8d9d9d3f9\0.0.1\PackSolution.ps1: line 44
2020-06-10T10:43:46.5236017Z ##[debug]at , : line 1
2020-06-10T10:43:46.5258163Z ##[debug]at , : line 22
2020-06-10T10:43:46.5279086Z ##[debug]at , : line 18
2020-06-10T10:43:46.5300801Z ##[debug]at , : line 1
2020-06-10T10:43:46.5333477Z ##[debug]Exception:
2020-06-10T10:43:46.5398612Z ##[debug]Microsoft.PowerShell.Commands.WriteErrorException: SolutionPackager failed: 2
2020-06-10T10:43:46.5810057Z ##[error]SolutionPackager failed: 2
2020-06-10T10:43:46.5822707Z ##[debug]Processed: ##vso[task.logissue type=error]SolutionPackager failed: 2
2020-06-10T10:43:46.5834280Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-06-10T10:43:46.6279714Z ##[section]Finishing: Power Platform Pack Solution

  • David Jenni Profile Picture
    Microsoft Employee on at
    Re: PowerApp build tools: "Build Managed Solution" Pipeline failing on Task "Power platform Pack solution. SolutionPackager.exe return error code 2

    argh, the infamous "space in paths" bug strikes again 😞

    I've filed a bug to fix this on our end that will go out with our next refresh.
    In the meantime as work around (if you can), please change your "Source folder" and "Solution Output File" paths to NOT have a space in their folder/filenames


    2020-06-10T10:43:46.0892786Z ##[command]"D:\a\1_t\PA_BT\Microsoft.CrmSdk.CoreTools.9.1.0.39\content\bin\coretools\SolutionPackager.exe" /allowDelete:Yes /action:Pack /zipFile:D:\a\1\s\Solution Output File: D:\a\1\a\FlowSolutionTest.zip /allowWrite:Yes /folder:D:\a\1\s\FlowSolutionTest /packagetype:Unmanaged
    2020-06-10T10:43:46.1728126Z SolutionPackger CRM Solution Packaging Tool [Version 9.1.0.42]
    2020-06-10T10:43:46.1748134Z © 2017 Microsoft Corporation. All rights reserved
    2020-06-10T10:43:46.1751047Z
    2020-06-10T10:43:46.1856833Z Unrecognized command line argument 'Output'
    2020-06-10T10:43:46.1857219Z Unrecognized command line argument 'File:'
    2020-06-10T10:43:46.1857804Z Unrecognized command line argument 'D:\a\1\a\FlowSolutionTest.zip'
    2020-06-10T10:43:46.1861346Z

  • EricRegnier Profile Picture
    8,714 Most Valuable Professional on at
    Re: PowerApp build tools: "Build Managed Solution" Pipeline failing on Task "Power platform Pack solution. SolutionPackager.exe return error code 2

    Hi @UmerJavedD365,

    To use the Pack task, you need to unpack first. Have you unpacked the solution from Dev first (usually committed to source control afterwards) and then packed it from the location you unpacked?

    Thanks

     

  • Rohit Sharma354 Profile Picture
    on at
    Re: PowerApp build tools: "Build Managed Solution" Pipeline failing on Task "Power platform Pack solution. SolutionPackager.exe return error code 2

    Hello,

     

    It's difficult to find out what can be the root cause and will require deeper investigation.

     

    I would suggest opening up a Support Ticket with Microsoft to get this checked further.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

Overall leaderboard