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
Check if .NET 8 is installed by running the command:
dotnet --list-sdks
- If a version starting with
8.0
is listed, then dotnet 8 is installed. - Download from the Microsoft website here: https://dotnet.microsoft.com/en-us/download/dotnet/8.0
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.
- Installation instructions for Windows: https://github.com/coreybutler/nvm-windows#installation--upgrades
- Installation instructions for Linux / MacOS: https://github.com/nvm-sh/nvm#installing-and-updating
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
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.
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.
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.
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:
- Import the solution first, and configure the control to appear on the form.
- Start the pcf test harness on your computer, and leave it running.
You can close the browser tab that openedhttp://localhost:8181
if desired. - 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 replacingx.y.z
in the<control ... version="x.y.z">
attribute. (see here)
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