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

Case Study
06 Sep, 2024

Implementation of Business Central for a Trading Organization

Customer Overview A prominent trading organization sought to enhance its operational efficiency and streamline its business processes by implementing Dynamics…

READ MORE
Blogs
03 Sep, 2024

Optimizing Code Check-ins: Ignoring Unnecessary Files for a Cleaner Azure DevOps Repo.

Introduction In this blog, we will learn about the code check-in process in DevOps. After development, unnecessary files are sometimes…

READ MORE
Blogs
20 Aug, 2024

Configure Macros in Omnichannel to improve Agent Productivity

What are Macros? Macros are a set of sequential actions that a user performs. They enable users to perform daily…

READ MORE