pac solution
Commands for working with Dataverse solution projects
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. |
Add license and plan info to the solution.
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
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
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
License plan definition file in CSV format; expected columns: Service ID, Display name, More info URL.
License plan mapping file in CSV format; expected columns: Service ID, Component name
Adds a reference from the project in the current directory to the project at 'path'
pac solution add-reference --path c:\Users\Downloads\SampleComponent
The path to the referenced project
Add one or more solution components to the target unmanaged solution in Dataverse.
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
The schema name or ID of the component to add to the target solution.
The value that represents the solution component that you're adding.
Name of the solution.
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 URL or ID of the target environment.
Upload a Dataverse solution project to run against the Power Apps Checker service.
pac solution check --path c:\Users\Documents\Solution.zip --outputDirectory c:\samplepackage --geo UnitedStates
Clears the solution checker enforcement cache, for your tenant, of all records that pertain to past results for your solutions.
This parameter requires no value. It's a switch.
Specify a custom URL as the Power Apps Checker endpoint.
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.
Exclude Files from the Analysis. Pass as comma-separated values
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
Sweden
USGovernment
USGovernmentL4
USGovernmentL5DoD
China
Output directory
Path where one or more solution files to be checked exist. The path can contain glob/wildcard characters.
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"}]
Select a rule set that is executed as part of this build. Values: A valid Guid, "AppSource Certification", "Solution Checker" (default).
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.
SAS Uri pointing to solution.zip to be analyzed
Create a solution project based on an existing solution in your organization.
The following examples show the use of the pac solution clone
command.
This example clones the solution sampleSolution
to the current directory.
pac solution clone --name sampleSolution
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
The name of the solution to be exported.
Exports the solution asynchronously.
This parameter requires no value. It's a switch.
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.
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
Extract or merge all string resources into .resx files.
This parameter requires no value. It's a switch.
The full path to a mapping xml file from which to read component folders to pack.
Max asynchronous wait time in minutes. The default value is 60 minutes.
Output directory
Specifies the extraction type for the solution. Can be: 'Unmanaged', 'Managed' or 'Both'. The default value is: 'Both'.
Deprecated: This parameter is ignored.
Create a settings file from solution zip or solution folder.
pac solution create-settings --solution-zip C:\SampleSolution.zip --settings-file .\SampleDeploymentSettingsDev.json
The .json file with the deployment settings for connection references and environment variables.
Path to the local, unpacked solution folder: either the root of the 'Other/Solution.xml' file or a folder with a .cdsproj file.
Path to solution zip file.
Delete a solution from Dataverse in the current environment.
pac solution delete --solution-name Samplesolution
Name of the solution.
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.
Export a solution from Dataverse.
pac solution export --path c:\Users\Documents\Solution.zip --name SampleComponentSolution --managed true --include general
The name of the solution to be exported.
Exports the solution asynchronously.
This parameter requires no value. It's a switch.
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.
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
Whether the solution should be exported as a managed solution.
This parameter requires no value. It's a switch.
Max asynchronous wait time in minutes. The default value is 60 minutes.
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 where the exported solution zip file is written.
Deprecated: This parameter is ignored.
Import the solution into Dataverse.
pac solution import --path c:\Users\Documents\Solution.zip
Activate plug-ins and workflows on the solution.
This parameter requires no value. It's a switch.
Imports the solution asynchronously.
This parameter requires no value. It's a switch.
Convert to a managed solution.
This parameter requires no value. It's a switch.
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 an overwrite of unmanaged customizations
This parameter requires no value. It's a switch.
Import the solution as a holding solution.
This parameter requires no value. It's a switch.
Max asynchronous wait time in minutes. The default value is 60 minutes.
Path to solution zip file. If not specified, assumes the current folder is a cdsproj project.
Publish your changes upon a successful import.
This parameter requires no value. It's a switch.
The .json file with the deployment settings for connection references and environment variables.
Skip dependency check against dependencies flagged as product update
This parameter requires no value. It's a switch.
Skip solution import if same or higher version is present in current environment.
This parameter requires no value. It's a switch.
Import and upgrade the solution.
This parameter requires no value. It's a switch.
You be connected to an environment using the pac auth command to use pac solution import
.
When Path
parameter is not specified, it assumes the current folder is a cdsproj project. If the SolutionPackageType
property in cdsproj file is set to Both
, the managed solution is used by default.
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.
Initializes a directory with a new Dataverse solution project
pac solution init --publisher-name developer --publisher-prefix dev
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 _.
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'.
Output directory
List all Solutions from the current Dataverse organization
pac solution list
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 system solutions like those published by Microsoft
This parameter requires no value. It's a switch.
Returns the output of the command as a JSON formatted string.
Sets version for solution loaded in Dataverse.
pac solution online-version --solution-name Samplesolution --solution-version 1.0.0.2
Name of the solution.
Specify the solution version number.
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.
Package solution components on local filesystem into solution.zip (SolutionPackager).
pac solution pack --zipfile C:\SampleSolution.zip --folder .\SampleSolutionUnpacked\.
The full path to the solution ZIP file
Dictates if delete operations may occur. The default value is 'false'.
This parameter requires no value. It's a switch.
Dictates if write operations may occur. The default value is 'false'.
This parameter requires no value. It's a switch.
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.
Disabled plug-in fully qualified type name remapping. The default value is 'false'.
This parameter requires no value. It's a switch.
Minimum logging level for log output [Verbose|Info|Warning|Error|Off]. The default value is 'Info'.
The path to the root folder on the local filesystem. When unpacking or extracting, this is written to. When packing this is read from.
Extract or merge all string resources into .resx files.
This parameter requires no value. It's a switch.
The path to the log file.
The full path to a mapping xml file from which to read component folders to pack.
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'.
Only perform action on a single component type [WebResource|Plugin|Workflow|None]. The default value is 'None'.
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.
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.
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.
Publishes all customizations
pac solution publish
Publishes all customizations asynchronously
This parameter requires no value. It's a switch.
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 asynchronous wait time in minutes. The default value is 60 minutes.
Sync the current Dataverse solution project to the current state of the solution in your organization.
The following examples show the use of the pac solution sync
command.
This example syncs the solution to the current directory.
pac solution sync
Exports the solution asynchronously.
This parameter requires no value. It's a switch.
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.
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
Extract or merge all string resources into .resx files.
This parameter requires no value. It's a switch.
The full path to a mapping xml file from which to read component folders to pack.
Max asynchronous wait time in minutes. The default value is 60 minutes.
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'.
Path to the local, unpacked solution folder: either the root of the 'Other/Solution.xml' file or a folder with a .cdsproj file.
Extract solution components from solution.zip onto local filesystem (SolutionPackager).
pac solution unpack --zipfile C:\SampleSolution.zip --folder .\SampleSolutionUnpacked\.
The full path to the solution ZIP file
Dictates if delete operations may occur. The default value is 'false'.
This parameter requires no value. It's a switch.
Dictates if write operations may occur. The default value is 'false'.
This parameter requires no value. It's a switch.
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.
Disabled plug-in fully qualified type name remapping. The default value is 'false'.
This parameter requires no value. It's a switch.
Minimum logging level for log output [Verbose|Info|Warning|Error|Off]. The default value is 'Info'.
The path to the root folder on the local filesystem. When unpacking or extracting, this is written to. When packing this is read from.
Extract or merge all string resources into .resx files.
This parameter requires no value. It's a switch.
The path to the log file.
The full path to a mapping xml file from which to read component folders to pack.
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'.
Only perform action on a single component type [WebResource|Plugin|Workflow|None]. The default value is 'None'.
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.
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.
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.
Apply solution upgrade
pac solution upgrade --solution-name SampleSolution --async --max-async-wait-time 60
Name of the solution.
Upgrades solution asynchronously
This parameter requires no value. It's a switch.
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 asynchronous wait time in minutes. The default value is 60 minutes.
Update build or revision version for the solution.
pac solution version --patchversion 2
pac solution version --strategy gittags
Build version for the solution.
Note: The value must be an integer with minimum value of 0.
Tracker CSV file name to be used when using filetracking as a strategy. The default value is 'ControlsStateVersionInfo.csv'.
Deprecated: This parameter is ignored.
Revision version for the solution.
Note: The value must be an integer with minimum value of 0.
Path to Dataverse solution directory or Solution.xml file.
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
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.
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.
The developer doesn't have to unpack the cloned solution because it's rendered in an unpacked format within the src (source) folder.
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.
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.
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.
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.
Microsoft Power Platform CLI Command Groups
Microsoft Power Platform CLI overview