pac solution

Commands for working with Dataverse solution projects

Commands

Command Description
pac solution add-license Add license and plan info to solution
pac solution add-reference Adds a reference from the project in the current directory to the project at 'path'
pac solution add-solution-component Add solution component(s) to the target unmanaged solution in Dataverse.
pac solution check Upload a Dataverse Solution project to run against the Power Apps Checker Service
pac solution clone Create a solution project based on an existing solution in your Organization
pac solution create-settings Create a settings file from solution zip or solution folder.
pac solution delete Delete solution from Dataverse in the current Environment.
pac solution export Export a solution from Dataverse.
pac solution import Import the solution into Dataverse.
pac solution init Initializes a directory with a new Dataverse solution project
pac solution list List all Solutions from the current Dataverse Organization
pac solution online-version Sets version for solution loaded in Dataverse.
pac solution pack Package solution components on local filesystem into solution.zip (SolutionPackager)
pac solution publish Publishes all customizations
pac solution sync Sync the current Dataverse solution project to the current state of the solution in your Organization.
pac solution unpack Extract solution components from solution.zip onto local filesystem (SolutionPackager)
pac solution upgrade Option to stage the Dataverse solution for upgrade
pac solution version Update build or revision version for solution

pac solution add-license

Add license and plan info to solution

Required Parameters

--planDefinitionFile -pd

License plan definition file in CSV format; expected columns: Service ID, Display name, More info URL

--planMappingFile -pm

License plan mapping file in CSV format; expected columns: Service ID, Component name

pac solution add-reference

Adds a reference from the project in the current directory to the project at 'path'

Example

pac solution add-reference --path c:\Users\Downloads\SampleComponent

Required Parameters

--path -p

The path to the referenced project

pac solution add-solution-component

Add solution component(s) to the target unmanaged solution in Dataverse.

Required Parameters

--component -c

The schema name or ID of the component to add to the target solution

--componentType -ct

The value that represents the solution component that you are adding

--solutionUniqueName -sn

Name of the solution

Optional Parameters

--AddRequiredComponents -arc

Indicates whether other solution components that are required by the solution component that you are adding should also be added to the unmanaged solution

This parameter requires no value. It is a switch.

--environment -env

Environment URL or ID of the target environment.

pac solution check

Upload a Dataverse Solution project to run against the Power Apps Checker Service

Example

pac solution check --path c:\Users\Documents\Solution.zip --outputDirectory c:\samplepackage --geo UnitedStates

Optional Parameters

--customEndpoint -ce

Specify a custom URL as Power Apps Checker endpoint

--excludedFiles -ef

Exclude Files from the Analysis. Pass as comma-separated values

--geo -g

Which geographical instance of the Power Apps Checker service to use.

Use one of these values:

  • PreviewUnitedStates
  • UnitedStates
  • Europe
  • Asia
  • Australia
  • Japan
  • India
  • Canada
  • SouthAmerica
  • UnitedKingdom
  • France
  • Germany
  • UnitedArabEmirates
  • Switzerland
  • USGovernment
  • USGovernmentL4
  • USGovernmentL5DoD
  • China

--outputDirectory -o

Output directory

--path -p

Path where the to-be-checked solution zip file(s) exist; path can contain glob/wildcard characters

--ruleLevelOverride -rl

Path to a file containing a JSON array rules and levels to override. Accepted values for OverrideLevel are: Critical, High, Medium, Low, Informational. Example: [{"Id":"meta-remove-dup-reg","OverrideLevel":"Medium"},{"Id":"il-avoid-specialized-update-ops","OverrideLevel":"Medium"}]

--ruleSet -rs

Select a rule set that will be executed as part of this build. Values: A valid Guid, "AppSource Certification", "Solution Checker" (default)

--solutionUrl -u

SAS Uri pointing to solution.zip to be analyzed

pac solution clone

Create a solution project based on an existing solution in your Organization

Examples

The following examples show the use of the pac solution clone command.

Basic clone

This example clones the solution sampleSolution to the current directory.

pac solution clone --name sampleSolution

Clone with general and auto numbering settings included

This example clones the solution sampleSolution to the current directory with the general and auto numbering settings included.

pac solution clone --name sampleSolution --include general,autonumbering

Clone with canvas app unpack

This example clones the solution sampleSolution and unpacks the Canvas Apps in one go.

pac solution clone --name sampleSolution --processCanvasApps

Required Parameters

--name -n

The name of the solution to be exported

Optional Parameters

--async -a

Exports solution asynchronously

This parameter requires no value. It is a switch.

--include -i

Which settings should be included in the solution being exported

Use one or more of these values separated by commas:

  • autonumbering
  • calendar
  • customization
  • emailtracking
  • externalapplications
  • general
  • isvconfig
  • marketing
  • outlooksynchronization
  • relationshiproles
  • sales

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--outputDirectory -o

Output directory

--packagetype -p

Specifies the extraction type for the solution. Can be: 'Unmanaged', 'Managed' or 'Both'; default: 'Both'

--processCanvasApps -pca

(Preview) Pack/unpack any Canvas apps (.msapp) while processing the solution. default: false

This parameter requires no value. It is a switch.

--targetversion -v

Deprecated: This parameter will be ignored.

pac solution create-settings

Create a settings file from solution zip or solution folder.

Example

pac solution create-settings --solution-zip C:\SampleSolution.zip --settings-file .\SampleDeploymentSettingsDev.json

Optional Parameters

--settings-file -s

The .json file with the deployment settings for connection references and environment variables.

--solution-folder -f

Path to the local, unpacked solution folder: either the root of the 'Other/Solution.xml' file or a folder with a .cdsproj file.

--solution-zip -z

Path to solution zip file.

pac solution delete

Delete solution from Dataverse in the current Environment.

Example

pac solution delete --solution-name Samplesolution

Required Parameters

--solution-name -sn

Name of the solution

pac solution export

Export a solution from Dataverse.

Example

pac solution export --path c:\Users\Documents\Solution.zip --name SampleComponentSolution --managed true --include general

Required Parameters

--name -n

The name of the solution to be exported

--path -p

Path where the exported solution zip file will be written

Optional Parameters

--async -a

Exports solution asynchronously

This parameter requires no value. It is a switch.

--include -i

Which settings should be included in the solution being exported

Use one or more of these values separated by commas:

  • autonumbering
  • calendar
  • customization
  • emailtracking
  • externalapplications
  • general
  • isvconfig
  • marketing
  • outlooksynchronization
  • relationshiproles
  • sales

--managed -m

Whether the solution should be exported as a managed solution

This parameter requires no value. It is a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--overwrite -ow

The exported solution file can overwrite the solution zip file on the local file system.

This parameter requires no value. It is a switch.

--targetversion -v

Deprecated: This parameter will be ignored.

pac solution import

Import the solution into Dataverse.

Example

pac solution import --path c:\Users\Documents\Solution.zip

Optional Parameters

--activate-flows -af

Turn on workflows specified in the deployment settings file using a specified user

This parameter requires no value. It is a switch.

--activate-plugins -ap

Activate plug-ins and workflows on the solution

This parameter requires no value. It is a switch.

--async -a

Imports solution asynchronously

This parameter requires no value. It is a switch.

--convert-to-managed -cm

Convert as Managed Solution

This parameter requires no value. It is a switch.

--force-overwrite -f

Force an overwrite of unmanaged customizations

This parameter requires no value. It is a switch.

--import-as-holding -h

Import the solution as a holding solution

This parameter requires no value. It is a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--path -p

Path to solution zip file. If not specified, assumes the current folder is a cdsproj project.

--publish-changes -pc

Publish your changes upon a successful import

This parameter requires no value. It is a switch.

--settings-file

The .json file with the deployment settings for connection references and environment variables.

--skip-dependency-check -s

Skip dependency check against dependencies flagged as product update

This parameter requires no value. It is a switch.

Remarks

You be connected to an environment using the pac auth command to use pac solution import.

covert-to-managed

The covert-to-managed parameter doesn't take an unmanaged solution and import it as managed. This parameter allows a managed solution that is being imported into an environment convert unmanaged components to managed.

If this flag isn't explicitly set, the solution system will fail the import request because managed layers can't go on top of unmanaged base components. This switch allows the solution import to succeed and the net result is that the inbound managed solution will be the base layer for each of these components – the components in the destination environment are converted from being an unmanaged component to being a managed component.

pac solution init

Initializes a directory with a new Dataverse solution project

Example

pac solution init --publisher-name developer --publisher-prefix dev

Required Parameters

--publisher-name -pn

Name of the Dataverse solution publisher

Note: Only characters within the ranges [A - Z], [a - z], [0 - 9], or _ are allowed. The first character may only be in the ranges [A - Z], [a - z], or _.

--publisher-prefix -pp

Customization prefix value for the Dataverse solution publisher

Note: The prefix must be 2 to 8 characters long, can only consist of alpha-numerics, must start with a letter, and cannot start with 'mscrm'.

Optional Parameters

--outputDirectory -o

Output directory

pac solution list

List all Solutions from the current Dataverse Organization

Example

pac solution list

Optional Parameters

--environment -env

The target Environment ID or URL. Default value is the environment of your currently active Dataverse Auth Profile.

--environment-id

Deprecated: Use --environment instead.

pac solution online-version

Sets version for solution loaded in Dataverse.

Example

pac solution online-version --solution-name Samplesolution --solution-version 1.0.0.2

Required Parameters

--solution-name -sn

Name of the solution

--solution-version -sv

Specify the solution version number.

pac solution pack

Package solution components on local filesystem into solution.zip (SolutionPackager)

Example

pac solution pack --zipfile C:\SampleSolution.zip --folder .\SampleSolutionUnpacked\.

Required Parameters

--zipfile -z

The full path to the solution ZIP file

Optional Parameters

--allowDelete -ad

Dictates if delete operations may occur; default: false.

This parameter requires no value. It is a switch.

--allowWrite -aw

Dictates if write operations may occur; default: false.

This parameter requires no value. It is a switch.

--clobber -c

Enables that files marked read-only can be deleted or overwritten; default: false.

This parameter requires no value. It is a switch.

--disablePluginRemap -dpm

Disabled plug-in fully qualified type name remapping. default: false

This parameter requires no value. It is a switch.

--errorlevel -e

Minimum logging level for log output [Verbose|Info|Warning|Error|Off]; default: Info

--folder -f

The path to the root folder on the local filesystem. When unpacking/extractins, this will be written to, when packing this will be read from.

--localize -loc

Extract or merge all string resources into .resx files.

This parameter requires no value. It is a switch.

--log -l

The path to the log file.

--map -m

The full path to a mapping xml file from which to read component folders to pack.

--packagetype -p

When unpacking/extracting, use to specify dual Managed and Unmanaged operation. When packing, use to specify Managed or Unmanaged from a previous unpack 'Both'. Can be: 'Unmanaged', 'Managed' or 'Both'; default: 'Unmanaged'

--processCanvasApps -pca

(Preview) Pack/unpack any Canvas apps (.msapp) while processing the solution. default: false

This parameter requires no value. It is a switch.

--singleComponent -sc

Only perform action on a single component type [WebResource|Plugin|Workflow|None]; default: None.

--sourceLoc -src

Generates a template resource file. Valid only on Extract. Possible Values are auto or an LCID/ISO code of the language you wish to export. When Present, this will extract the string resources from the given locale as a neutral .resx. If auto or just the long or short form of the switch is specified the base locale for the solution will be used.

--useLcid -lcid

Use LCID's (1033) rather than ISO codes (en-US) for language files.

This parameter requires no value. It is a switch.

--useUnmanagedFileForMissingManaged -same

Use the same XML source file when packaging for Managed and only Unmanaged XML file is found; applies to AppModuleSiteMap, AppModuleMap, FormXml files

This parameter requires no value. It is a switch.

pac solution publish

Publishes all customizations

Example

pac solution publish

Optional Parameters

--async -a

Publishes all customizations asynchronously

This parameter requires no value. It is a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

pac solution sync

Sync the current Dataverse solution project to the current state of the solution in your Organization.

Examples

The following examples show the use of the pac solution sync command.

Basic sync

This example syncs the solution to the current directory.

pac solution sync

Sync with canvas app unpack

This example syncs the solution to the current directory and unpacks the canvas apps in one go.

pac solution sync --processCanvasApps

Optional Parameters

--async -a

Exports solution asynchronously

This parameter requires no value. It is a switch.

--include -i

Which settings should be included in the solution being exported

Use one or more of these values separated by commas:

  • autonumbering
  • calendar
  • customization
  • emailtracking
  • externalapplications
  • general
  • isvconfig
  • marketing
  • outlooksynchronization
  • relationshiproles
  • sales

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--packagetype -p

When unpacking/extracting, use to specify dual Managed and Unmanaged operation. When packing, use to specify Managed or Unmanaged from a previous unpack 'Both'. Can be: 'Unmanaged', 'Managed' or 'Both'; default: 'Unmanaged'

--processCanvasApps -pca

(Preview) Pack/unpack any Canvas apps (.msapp) while processing the solution. default: false

This parameter requires no value. It is a switch.

--solution-folder -f

Path to the local, unpacked solution folder: either the root of the 'Other/Solution.xml' file or a folder with a .cdsproj file.

pac solution unpack

Extract solution components from solution.zip onto local filesystem (SolutionPackager)

Example

pac solution unpack --zipfile C:\SampleSolution.zip --folder .\SampleSolutionUnpacked\.

Required Parameters

--zipfile -z

The full path to the solution ZIP file

Optional Parameters

--allowDelete -ad

Dictates if delete operations may occur; default: false.

This parameter requires no value. It is a switch.

--allowWrite -aw

Dictates if write operations may occur; default: false.

This parameter requires no value. It is a switch.

--clobber -c

Enables that files marked read-only can be deleted or overwritten; default: false.

This parameter requires no value. It is a switch.

--disablePluginRemap -dpm

Disabled plug-in fully qualified type name remapping. default: false

This parameter requires no value. It is a switch.

--errorlevel -e

Minimum logging level for log output [Verbose|Info|Warning|Error|Off]; default: Info

--folder -f

The path to the root folder on the local filesystem. When unpacking/extractins, this will be written to, when packing this will be read from.

--localize -loc

Extract or merge all string resources into .resx files.

This parameter requires no value. It is a switch.

--log -l

The path to the log file.

--map -m

The full path to a mapping xml file from which to read component folders to pack.

--packagetype -p

When unpacking/extracting, use to specify dual Managed and Unmanaged operation. When packing, use to specify Managed or Unmanaged from a previous unpack 'Both'. Can be: 'Unmanaged', 'Managed' or 'Both'; default: 'Unmanaged'

--processCanvasApps -pca

(Preview) Pack/unpack any Canvas apps (.msapp) while processing the solution. default: false

This parameter requires no value. It is a switch.

--singleComponent -sc

Only perform action on a single component type [WebResource|Plugin|Workflow|None]; default: None.

--sourceLoc -src

Generates a template resource file. Valid only on Extract. Possible Values are auto or an LCID/ISO code of the language you wish to export. When Present, this will extract the string resources from the given locale as a neutral .resx. If auto or just the long or short form of the switch is specified the base locale for the solution will be used.

--useLcid -lcid

Use LCID's (1033) rather than ISO codes (en-US) for language files.

This parameter requires no value. It is a switch.

--useUnmanagedFileForMissingManaged -same

Use the same XML source file when packaging for Managed and only Unmanaged XML file is found; applies to AppModuleSiteMap, AppModuleMap, FormXml files

This parameter requires no value. It is a switch.

pac solution upgrade

Option to stage the Dataverse solution for upgrade

Example

pac solution upgrade --solution-name SampleSolution --async --max-async-wait-time 60

Required Parameters

--solution-name -sn

Name of the solution

Optional Parameters

--async -a

Upgrades solution asynchronously

This parameter requires no value. It is a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

pac solution version

Update build or revision version for solution

Example

pac solution version --patchversion 2
pac solution version --strategy gittags

Optional Parameters

--buildversion -bv

Build version for solution

Note: The value must be a positive integer

--filename -fn

Tracker CSV file name to be used when using filetracking as a strategy. Default value is ControlsStateVersionInfo.csv

--patchversion -pv

Deprecated: This parameter will be ignored.

--revisionversion -rv

Revision version for solution

Note: The value must be a positive integer

--strategy -s

Updates build version for 'Solution.xml' file using specified strategy. If using gittags, set personal access token in the following environment variable "PacCli.PAT"

Use one of these values:

  • gittags
  • filetracking
  • solution

Differences between pac solution clone and export

There are situations where you're unsure when to use pac solution clone or pac solution export command. You can use one of the commands in the following scenarios:

  • Use pac solution clone when you need to add new components to the solution.
  • Use pac solution export when you want to modify the existing content in a solution file but not adding any new components to the solution.

pac solution clone

The exported solution looks like a Visual Studio project when you export the solution using the pac solution clone command. Instead of a .csproj (as in Visual Studio), you'll see a cdsproj file. The cdsproj file has all the components information that is required to build the project. The build output is a solution zip file, which you can import into different environments.

Pac solution clone.

The developer doesn't have to unpack the cloned solution because it's rendered in an unpacked format within the src (source) folder.

Pac solution unpack.

Now, if you want to associate a newly created plug-in with this solution, with the solution unpacked, you can use the pac solution add-reference command to update the .cdsproj file to add the new plug-in. Then, you can build the project using either dotnet build or msbuild.

It's recommended to do a build restore first before building the project. A build restore (dotnet build does a restore first automatically) will restore the required .NET libraries to generate a packed solution.

pac solution export

When you export the solution using pac solution export you feel like exporting the solution using the maker portal, and the resulting output is a solution zip file.

Pac solution export.

When you unpack the solution zip file (we don't recommend that you open the zip with standard tools and use the appropriate command from CLI). The resulting directory structure is similar to the structure in pac solution clone. The only difference is that you can't add references to this unpacked solution, as it doesn't have the .cdsproj project file.

Pac solution structure.

You can modify the relevant set of files that you want to update and then proceed with the solution pack, which generates the solution zip file again to facilitate importing the solution into the target environment. The result from the action is a solution zip file with updated contents and an updated timestamp.

See also

Microsoft Power Platform CLI Command Groups
Microsoft Power Platform CLI overview