Study FAQ
How do I package a PCF component and make a model-driven form use it?
Also asked as 2
- How do I move a PCF field control from local testing to a solution and consuming app?
- Why does an imported PCF control not appear on my form?
Answer
Build the PCF component into a solution package, import that package into an authorized Dataverse environment, and configure the target form to use the control. Import makes the component available to makers. The consuming form needs its own compatible binding and published customization.
Use Microsoft Power Platform CLI and the documented .NET build tools. Build the component for production with npm run build -- --buildMode production. In a separate solution project, run pac solution init with your approved publisher name and prefix, then pac solution add-reference --path <component-project-path>. Run dotnet build --configuration Release there and check the intended package type and contents because project settings can override defaults.
In an isolated target, bind the intended column, set configurable inputs, save and publish. Verify under the intended user, save and reopen a synthetic row, and repeat with a second compatible column if reuse is a requirement. Use the local npm start watch harness for rapid rendering checks. Use pac pcf push only for the intended development loop and confirm your auth profile and environment first. During cleanup, remove the association on the test forms and publish the forms before attempting to remove the component solution.
PCF deployment and ALM · pac solution reference · pac pcf reference
Full explanation
AB-400: Building Reusable PCF Code Components
Study guide · AB-400
Read the full explanation