knowledgecenter-breadcrum

Knowledge Center

01 Aug, 2024

Deploying PCF Controls to Dataverse Using CLI

Posted on 01 Aug, 2024 by Ankit Gore, Posted in PCF (PowerApps Component Framework) Dataverse Power Platform

Blogs

Introduction

In this blog, we will deploy the PCF code component using the CLI. With this approach, you won't need to manually import the solution into the Dataverse environment. Instead, you can run CLI commands to import your solution directly into the target environment.

Prerequisites

  • A Microsoft Dataverse environment with admin access
  • Power Apps CLI installed on your machine
  • A code editor of your choice (e.g., Visual Studio Code)
  • A PCF control project created
  • npm installed on your system
  • MSBuild installed on your system. Ensure that MSBuild is added to the System Environment Variables.
     

Step-by-Step Guide

Step 1: Creating the solution to deploy.

  1. Open the Solution folder path in CMD.
     
  2. If the solution folder is not created, create it. Then, inside that folder, run the following command to create the solution project. Provide the publisher name and prefix for the solution in the command.
     pac solution init --publisher-name developer --publisher-prefix dev
  3. Now, run this command in the Solution folder path.
    pac solution add-reference --path c:/FolderPath of PCF Project
     
  4. Run command
    msbuild /t:restore
     
  5. Run command to build the debug solution in bin.
    msbuild


Step 2: Connecting to your environment.

To deploy the code components directly, use the Microsoft Power Platform CLI to connect to the Dataverse environment and then push the updated components.

  1. Create an authentication profile using the command below. Provide the org URL:

    pac auth create --url https://xyz.crm.dynamics.com
     
  2. If you have previously created an authentication profile, you can view all the existing profiles using the command:

    pac auth list

    Example:
  3. To select your authentication profile from the list, run the command: 

    pac auth select --index

    Example:

     
  4. Now you are successfully connected to the environment.
     

Step 3: Deploying PCF code components.

After you have successfully created an authentication profile, you can start pushing the code components to the Dataverse instance with all the latest changes. Navigate to the directory where the PCF component file is located.

  1. Run the command “pac pcf push --publisher-prefix .

Note: The publisher prefix of your solution and the one provided in the command should be the same.

Wait for some time it will automatically deploy the PCF components in the environment.

I hope you find this helpful!

Comment

This is a Required Field

Loading

Recent Updates

Embed PowerBI Report To Form
Blogs
09 Sep, 2026

Embed a Power BI Report on a Dynamics 365 Form, Filtered to the Record You're Viewing

Most Power BI reports in a Dynamics 365 environment live somewhere the user has to go and find: a dashboard,…

READ MORE
Blogs
08 Sep, 2026

How to Dynamically Retrieve SharePoint Drive IDs and List GUIDs for Power Automate

Introduction Many times, we come across scenarios where we need to populate a Word template in Dynamics 365 using Power…

READ MORE
Blogs
11 Aug, 2026

How to Remove an Unmanaged Layer from a Dataverse Email Template

Overview Email Templates in Microsoft Dataverse make it easy to reuse email content such as subject lines, message bodies, and…

READ MORE