skills/pac-solutions/SKILL.md
Pack, unpack, clone, and manage Dynamics 365 solutions using the PAC CLI. Use when asked "unpack solution", "pack solution", "clone solution", "source control my solution", "compare solution files".
npx skillsauth add nickmeron/Dataverse-MCP-Server skills/pac-solutionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The user wants to work with solutions using the Power Platform CLI (pac).
Argument provided: $ARGUMENTS
Step 1 — Verify pac is installed:
pac help
If not installed, follow the install steps for the user's OS:
macOS / Linux:
# Requires .NET 9+
dotnet --version
# If dotnet is not installed: brew install dotnet
# PAC CLI 2.x has a broken NuGet package on macOS — use 1.52.1
dotnet tool install --global Microsoft.PowerApps.CLI.Tool --version 1.52.1
Windows:
dotnet tool install --global Microsoft.PowerApps.CLI.Tool
Or use the standalone MSI installer: https://aka.ms/PowerAppsCLI
Step 2 — Verify authentication:
pac auth list
If no profiles exist, check whether the user already authenticated via the MCP authenticate tool. If so, reuse those credentials:
pac auth create \
--name MCP \
--url ACTIVE_ENVIRONMENT_URL \
--applicationId MCP_CLIENT_ID \
--clientSecret "MCP_CLIENT_SECRET" \
--tenant MCP_TENANT_ID
If the user has NOT authenticated via MCP either, use the pac-auth skill.
This decomposes a solution .zip into individual XML/JSON files that can be version-controlled.
pac solution unpack --zipfile ./MySolution.zip --folder ./MySolution-unpacked
Options:
--packagetype Unmanaged (default) / Managed / Both--allowDelete true — Remove files from target folder that aren't in the zip--allowWrite true — Overwrite existing files--localize — Extract localized labels into separate RESX files--map mapfile.xml — Use a mapping file for file organization--sourceLoc auto — Extract source locale stringsTypical source control workflow:
# Export from environment (use MCP export_solution tool or pac)
pac solution export --name MySolution --path ./MySolution.zip --managed false
# Unpack for source control
pac solution unpack --zipfile ./MySolution.zip --folder ./src/MySolution
# Commit to git
cd ./src/MySolution
git add -A
git commit -m "Export MySolution v1.2.3"
Reassembles unpacked source files into a deployable .zip:
pac solution pack --folder ./MySolution-unpacked --zipfile ./MySolution.zip
Options:
--packagetype Unmanaged / Managed / Both--localize — Include localized content--map mapfile.xml — Use mapping fileDeployment workflow:
# Pack from source
pac solution pack --folder ./src/MySolution --zipfile ./MySolution_managed.zip --packagetype Managed
# Import to target (use MCP import_solution or pac)
pac solution import --path ./MySolution_managed.zip --activate-plugins
Creates a VS project that can build the solution:
pac solution clone --name MySolution --outputDirectory ./MySolution-project
This creates a .cdsproj file you can build with:
cd MySolution-project
dotnet build
The built .zip appears in bin/Debug/ or bin/Release/.
Use the MCP tools for API-based comparison, plus pac for file-level diffs:
pac auth select --index 1 # DEV
pac solution export --name MySolution --path ./dev-export.zip --managed false
pac auth select --index 2 # UAT
pac solution export --name MySolution --path ./uat-export.zip --managed false
pac solution unpack --zipfile ./dev-export.zip --folder ./dev-unpacked
pac solution unpack --zipfile ./uat-export.zip --folder ./uat-unpacked
diff -rq ./dev-unpacked ./uat-unpacked
# Or use git diff:
git diff --no-index ./dev-unpacked ./uat-unpacked
pac solution check --path ./MySolution.zip
This runs the Solution Checker (Power Apps checker) and returns warnings/errors about:
Options:
--outputDirectory ./results — Save results to a folder--ruleset solution-checker — Specify ruleset--geo Europe — Specify geography for the checker servicepac solution sync --solution-folder ./src/MySolution --packagetype Unmanaged
This exports from the connected environment and unpacks in one step. Equivalent to export + unpack.
After unpacking, you'll see:
MySolution/
├── Other/
│ ├── Customizations.xml # Main customization file
│ ├── Solution.xml # Solution metadata
│ └── Relationships.xml # Entity relationships
├── Entities/
│ ├── account/
│ │ ├── Entity.xml
│ │ ├── FormXml/
│ │ │ └── main/
│ │ │ └── {guid}.xml # Forms
│ │ ├── SavedQueries/
│ │ │ └── {guid}.xml # Views
│ │ └── RibbonDiff.xml
│ └── contact/
│ └── ...
├── OptionSets/ # Global option sets
├── Workflows/ # Cloud flows + workflows
├── PluginAssemblies/ # Plugin DLLs (base64)
├── WebResources/ # JS, HTML, CSS, images
├── Roles/ # Security roles
├── SiteMap/ # App site maps
└── CanvasApps/ # Canvas app packages
Create a map.xml to control unpacking layout:
<?xml version="1.0" encoding="utf-8"?>
<Mapping>
<FileToPath map="Entities/account/*.xml" to="entities\account" />
<FileToPath map="WebResources/*.js" to="webresources\scripts" />
<FileToPath map="WebResources/*.css" to="webresources\styles" />
<FileToPath map="WebResources/*.html" to="webresources\pages" />
<FileToPath map="Workflows/*.json" to="flows" />
</Mapping>
Use with: pac solution unpack --map map.xml ...
For Azure DevOps / GitHub Actions:
# GitHub Actions example
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install PAC
run: dotnet tool install --global Microsoft.PowerApps.CLI.Tool
- name: Auth
run: pac auth create --url ${{ secrets.D365_URL }} --applicationId ${{ secrets.CLIENT_ID }} --clientSecret ${{ secrets.CLIENT_SECRET }} --tenant ${{ secrets.TENANT_ID }}
- name: Export
run: pac solution export --name MySolution --path ./solution.zip
- name: Pack managed
run: pac solution pack --folder ./src/MySolution --zipfile ./managed.zip --packagetype Managed
- name: Import to target
run: |
pac auth create --url ${{ secrets.TARGET_URL }} --applicationId ${{ secrets.CLIENT_ID }} --clientSecret ${{ secrets.CLIENT_SECRET }} --tenant ${{ secrets.TENANT_ID }}
pac solution import --path ./managed.zip --activate-plugins
--version 1.52.1.--version 1.52.1 instead.pac solution listpac solution unpack --processCanvasApps--geo Europe for EMEA orgstesting
Create, monitor, and manage bulk deletion jobs in Dynamics 365. Use when asked "bulk delete", "delete all records of type X", "create a bulk delete job", "check bulk delete status", "cancel bulk delete", "why did bulk delete fail".
data-ai
Produce a business-readable summary of a Dynamics 365 record or set of records. Uses metadata to understand the schema before querying.
testing
Investigate users, security roles, teams, and permissions in Dynamics 365. Use when asked "who has access to...", "what roles does X have?", "compare roles", or "show me users".
data-ai
Query Dynamics 365 records using natural language. Translates questions into OData queries with metadata-aware field selection.