pac solution

Commands for working with Dataverse solution projects

Commands

Command Description
pac solution add-license Add license and plan info to the 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 one or more solution components 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 a 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 Apply solution upgrade
pac solution version Update build or revision version for the solution.

pac solution add-license

Add license and plan info to the solution.

Example

This example shows how to add licensing info to a solution.

pac solution add-license --planDefinitionFile ../ISV_Plan_Definition.csv --planMappingFile ../ISV_Plan_Mapping.csv

Plan Definition File

Below you'll find an example of the plan definition file:

ServiceID,Display name,More info URL
test_isvconnect1599092224747.d365_isvconnect_prod_licensable.bronzeplan,Fabrikam Bronze Plan,http://www.microsoft.com
test_isvconnect1599092224747.d365_isvconnect_prod_licensable.silverplan,Fabrikam Silver Plan,http://www.microsoft.com
test_isvconnect1599092224747.d365_isvconnect_prod_licensable.goldplan,Fabrikam Gold Plan,http://www.microsoft.com

Plan Mapping File

Below you'll find an example of the plan mapping file:

Service ID,Component name
test_isvconnect1599092224747.d365_isvconnect_prod_licensable.bronzeplan,crf36_BronzeApp
test_isvconnect1599092224747.d365_isvconnect_prod_licensable.silverplan,crf36_BronzeApp
test_isvconnect1599092224747.d365_isvconnect_prod_licensable.silverplan,crf36_SilverApp
test_isvconnect1599092224747.d365_isvconnect_prod_licensable.goldplan,crf36_BronzeApp
test_isvconnect1599092224747.d365_isvconnect_prod_licensable.goldplan,crf36_SilverApp
test_isvconnect1599092224747.d365_isvconnect_prod_licensable.goldplan,crf36_GoldApp

Required Parameters for solution add-license

--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 for solution add-reference

--path -p

The path to the referenced project

pac solution add-solution-component

Add one or more solution components to the target unmanaged solution in Dataverse.

Example

This example shows how to add a solution component to a solution. In this case, we're adding the contact table to the solution SampleSolution. A table is component type 1.

pac solution add-solution-component --solutionUniqueName SampleSolution --component contact --componentType 1

Required Parameters for solution add-solution-component

--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're adding.

--solutionUniqueName -sn

Name of the solution.

Optional Parameters for solution add-solution-component

--AddRequiredComponents -arc

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

This parameter requires no value. It's 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 for solution check

--customEndpoint -ce

Specify a custom URL as the Power Apps Checker endpoint.

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--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
  • SouthAfrica
  • Germany
  • UnitedArabEmirates
  • Switzerland
  • Norway
  • Singapore
  • Korea
  • USGovernment
  • USGovernmentL4
  • USGovernmentL5DoD
  • China

--outputDirectory -o

Output directory

--path -p

Path where one or more solution files to be checked exist. The 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 is executed as part of this build. Values: A valid Guid, "AppSource Certification", "Solution Checker" (default).

--saveResults -sav

Uses current environment to store solution analysis results that can be seen in Solution Health Hub App. By default, this argument is set to false.

This parameter requires no value. It's a switch.

--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 for solution clone

--name -n

The name of the solution to be exported.

Optional Parameters for solution clone

--async -a

Exports the solution asynchronously.

This parameter requires no value. It's a switch.

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--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

--localize -loc

Extract or merge all string resources into .resx files.

This parameter requires no value. It's a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. The default value is 60 minutes.

--outputDirectory -o

Output directory

--packagetype -p

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

--processCanvasApps -pca

(Preview) Pack/unpack any Canvas apps (.msapp) while processing the solution. The default value is 'false'.

This parameter requires no value. It's a switch.

--targetversion -v

Deprecated: This parameter is 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 for solution create-settings

--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 a solution from Dataverse in the current environment.

Example

pac solution delete --solution-name Samplesolution

Required Parameters for solution delete

--solution-name -sn

Name of the solution.

Optional Parameters for solution delete

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

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 for solution export

--name -n

The name of the solution to be exported.

Optional Parameters for solution export

--async -a

Exports the solution asynchronously.

This parameter requires no value. It's a switch.

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--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's a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. The 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's a switch.

--path -p

Path where the exported solution zip file is written.

--targetversion -v

Deprecated: This parameter is ignored.

pac solution import

Import the solution into Dataverse.

Example

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

Optional Parameters for solution import

--activate-plugins -ap

Activate plug-ins and workflows on the solution.

This parameter requires no value. It's a switch.

--async -a

Imports the solution asynchronously.

This parameter requires no value. It's a switch.

--convert-to-managed -cm

Convert to a managed solution.

This parameter requires no value. It's a switch.

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--force-overwrite -f

Force an overwrite of unmanaged customizations

This parameter requires no value. It's a switch.

--import-as-holding -h

Import the solution as a holding solution.

This parameter requires no value. It's a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. The 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's 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's a switch.

--skip-lower-version -slv

Skip solution import if same or higher version is present in current environment.

This parameter requires no value. It's a switch.

--stage-and-upgrade -up

Import and upgrade the solution.

This parameter requires no value. It's a switch.

Remarks

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

convert-to-managed

The convert-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 for solution init

--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 can't start with 'mscrm'.

Optional Parameters for solution init

--outputDirectory -o

Output directory

pac solution list

List all Solutions from the current Dataverse organization

Example

pac solution list

Optional Parameters for solution list

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--json

Returns the output of the command as a JSON formatted string.

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 for solution online-version

--solution-name -sn

Name of the solution.

--solution-version -sv

Specify the solution version number.

Optional Parameters for solution online-version

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

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 for solution pack

--zipfile -z

The full path to the solution ZIP file

Optional Parameters for solution pack

--allowDelete -ad

Dictates if delete operations may occur. The default value is 'false'.

This parameter requires no value. It's a switch.

--allowWrite -aw

Dictates if write operations may occur. The default value is 'false'.

This parameter requires no value. It's a switch.

--clobber -c

Enables that files marked read-only can be deleted or overwritten. The default value is 'false'.

This parameter requires no value. It's a switch.

--disablePluginRemap -dpm

Disabled plug-in fully qualified type name remapping. The default value is 'false'.

This parameter requires no value. It's a switch.

--errorlevel -e

Minimum logging level for log output [Verbose|Info|Warning|Error|Off]. The default value is 'Info'.

--folder -f

The path to the root folder on the local filesystem. When unpacking or extracting, this is written to. When packing this is read from.

--localize -loc

Extract or merge all string resources into .resx files.

This parameter requires no value. It's 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 or 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'. The default value is 'Unmanaged'.

--processCanvasApps -pca

(Preview) Pack/unpack any Canvas apps (.msapp) while processing the solution. The default value is 'false'.

This parameter requires no value. It's a switch.

--singleComponent -sc

Only perform action on a single component type [WebResource|Plugin|Workflow|None]. The default value is 'None'.

--sourceLoc -src

Generates a template resource file. Valid only on extract. Possible values are 'auto', or language code of the language you wish to export. You can use Language Code Identifier (LCID), or International Organization for Standardization (ISO) language code formats. When present, this extracts 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 is used.

--useLcid -lcid

Use Language Code Identifier (LCID) values (1033) rather than International Organization for Standardization (ISO) codes (en-US) for language files.

This parameter requires no value. It's 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's a switch.

pac solution publish

Publishes all customizations

Example

pac solution publish

Optional Parameters for solution publish

--async -a

Publishes all customizations asynchronously

This parameter requires no value. It's a switch.

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. The 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 for solution sync

--async -a

Exports the solution asynchronously.

This parameter requires no value. It's a switch.

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--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

--localize -loc

Extract or merge all string resources into .resx files.

This parameter requires no value. It's a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. The default value is 60 minutes.

--packagetype -p

When unpacking or 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'. The default value is: 'Both'.

--processCanvasApps -pca

(Preview) Pack/unpack any Canvas apps (.msapp) while processing the solution. The default value is 'false'.

This parameter requires no value. It's 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 for solution unpack

--zipfile -z

The full path to the solution ZIP file

Optional Parameters for solution unpack

--allowDelete -ad

Dictates if delete operations may occur. The default value is 'false'.

This parameter requires no value. It's a switch.

--allowWrite -aw

Dictates if write operations may occur. The default value is 'false'.

This parameter requires no value. It's a switch.

--clobber -c

Enables that files marked read-only can be deleted or overwritten. The default value is 'false'.

This parameter requires no value. It's a switch.

--disablePluginRemap -dpm

Disabled plug-in fully qualified type name remapping. The default value is 'false'.

This parameter requires no value. It's a switch.

--errorlevel -e

Minimum logging level for log output [Verbose|Info|Warning|Error|Off]. The default value is 'Info'.

--folder -f

The path to the root folder on the local filesystem. When unpacking or extracting, this is written to. When packing this is read from.

--localize -loc

Extract or merge all string resources into .resx files.

This parameter requires no value. It's 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 or 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'. The default value is 'Unmanaged'.

--processCanvasApps -pca

(Preview) Pack/unpack any Canvas apps (.msapp) while processing the solution. The default value is 'false'.

This parameter requires no value. It's a switch.

--singleComponent -sc

Only perform action on a single component type [WebResource|Plugin|Workflow|None]. The default value is 'None'.

--sourceLoc -src

Generates a template resource file. Valid only on extract. Possible values are 'auto', or language code of the language you wish to export. You can use Language Code Identifier (LCID), or International Organization for Standardization (ISO) language code formats. When present, this extracts 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 is used.

--useLcid -lcid

Use Language Code Identifier (LCID) values (1033) rather than International Organization for Standardization (ISO) codes (en-US) for language files.

This parameter requires no value. It's 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's a switch.

pac solution upgrade

Apply solution upgrade

Example

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

Required Parameters for solution upgrade

--solution-name -sn

Name of the solution.

Optional Parameters for solution upgrade

--async -a

Upgrades solution asynchronously

This parameter requires no value. It's a switch.

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. The default value is 60 minutes.

pac solution version

Update build or revision version for the solution.

Example

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

Optional Parameters for solution version

--buildversion -bv

Build version for the solution.

Note: The value must be an integer with minimum value of 0.

--filename -fn

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

--patchversion -pv

Deprecated: This parameter is ignored.

--revisionversion -rv

Revision version for the solution.

Note: The value must be an integer with minimum value of 0.

--solutionPath -sp

Path to Dataverse solution directory or Solution.xml file.

--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:

  • None
  • 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