Skip to content

Latest commit

 

History

History
95 lines (71 loc) · 3.55 KB

development.md

File metadata and controls

95 lines (71 loc) · 3.55 KB

Development

Building the control will require use of the command line.

There are two approaches to developing for this project:

  • Local machine development
  • Dev container development

Local Machine Development Prerequisites

.NET 8

Check if .NET 8 is installed by running the command:

dotnet --list-sdks

Node JS

Rather than installing Node JS directly, using a node version manager is recommended. This will make it easier to switch between node versions for different projects.

After nvm is installed, run the following command in the cloned repository to install the appropriate version of Node JS:

nvm use

Validate that the node version being used by running:

node --version

Dev Container Development Prerequisites

The devcontainer.json file includes NodeJS and .NET.

After cloning the repository, open the repo in vscode, then select the option to re-open in container.


Building from source

Inside the cloned repository, run the following command to build the solution containing the pcf control:

dotnet build

This will create a dist/ folder, and produce a managed solution inside it.

The managed solution can be imported into your CRM environment.


PCF Test Harness

The pcf test harness can be started by running the following commands:

cd ./control
npm install
npm run start

This will start the pcf test harness on port 8181, and can be accessed by opening http://localhost:8181 inside your web browser.


Testing the changes in CRM

Rather than building and importing the solution each time you have made a change to the control, you can start the pcf test harness by running npm run start inside the control/ folder and then run Telerik Fiddler to serve your local copy of the control and preview the changes within CRM.

Microsoft have provided instructions on how to do this using Fiddler. https://learn.microsoft.com/en-us/power-apps/developer/component-framework/debugging-custom-controls#debugging-after-deploying-into-microsoft-dataverse

Before testing this, there are a few things to keep in mind:

  1. Import the solution first, and configure the control to appear on the form.
  2. Start the pcf test harness on your computer, and leave it running.
    You can close the browser tab that opened http://localhost:8181 if desired.
  3. If you are changing the properties that are passed to the control, you will need to import the solution again with a higher version number specified in the ControlManifest.Input.xml, by replacing x.y.z in the <control ... version="x.y.z"> attribute. (see here)

Unit tests

Unit tests can be run locally by running the following command from the root of the repository:

dotnet test

Alternatively, the tests can be run via npm commands if preferred:

cd ./control
npm install
npm run test