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

Blogs
02 Jul, 2025

How to Show Icons in View Cells Based on Field Values in D365 CE

Introduction: In Dynamics 365, adding icons to view cells based on field values can make the interface more user-friendly and…

READ MORE
Blogs
01 Jul, 2025

Getting Started with Microsoft Access: Key Features and How to Use Them - Part 1

Getting Started with Microsoft Access: Key Features and How to Use Them Microsoft Access is a versatile and approachable database…

READ MORE
Thumbnail Image of ROI
Blogs
17 Jun, 2025

Maximizing ROI with Power Apps: The Role of Expert Consulting Services

Maximizing ROI with Power Apps: The Role of Expert Consulting Services Explore how skilled professionals can get you the best…

READ MORE