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

Thumbnail_top 10 benefits of
Blogs
02 Dec, 2024

Top 10 Benefits of Microsoft Dynamics 365

This blog lists the advantages of Microsoft Dynamics 365, focusing on how it can improve your business operations.    …

READ MORE
Thumbnail_Microsoft365 Vs D365
Blogs
12 Nov, 2024

Microsoft 365 vs Dynamics 365

This blog will help you understand the key difference between Microsoft 365 and Dynamics 365, so you can make an…

READ MORE
Thumbnail_What is Microsoft Dynamics 365
Blogs
05 Nov, 2024

What is Microsoft Dynamics 365?

This blog explores Microsoft Dynamics 365, a cloud solution for handling different business activities smoothly. The rising trends of competition…

READ MORE