Create and build a custom component

[This topic is pre-release documentation and is subject to change.]

This topic provides information on how to create and deploy a custom component using PowerApps component framework.

Ensure that you have installed Microsoft PowerApps CLI

Create a new component

To get started, open a new Developer Command Prompt for VS 2017 after installing PowerApps CLI.

  1. In the Developer Command Prompt for VS 2017, create a new folder on your local hard drive for example, C:\Users<your name>\Documents\My_PCF_Control

  2. Go to the newly created folder using the command cd <specify your new folder path>

  3. Run the following command to create a new component project by passing some basic parameters:

    pac pcf init --namespace <specify your namespace here> --name <put component name here> --template <component type>

    Note

    Currently, we offer two types of components: field and dataset.

  4. To retrieve all the required project dependencies, run the command npm install.

  5. Open your project folder (C:\Users\<your name>\Documents\My_PCF_Control\<component name>) in any developer environment of your choice and get started with your custom component development.

Build your component

To build your component you can open the folder in Visual Studio Code and use the (Ctrl-Shift-B) command, then select your build options. Alternately, you can build your control quickly using npm run build command in your Developer Command Prompt for VS 2017 window.

Tip

To debug your component during or after the build operation, see Debug custom components.

Known Configuration issues and Workarounds

Msbuild error MSB4036:

  1. The name of the task in the project file is the same as the name of the task class.
  2. The task class is public and implements the Microsoft.Build.Framework.ITask interface.
  3. The task is correctly declared with <UsingTask> in the project file or in the *.tasks files located in the directory.

Resolution:

  1. Open Visual Studio Installer.
  2. For VS 2017, select Modify.
  3. Click on Individual Components.
  4. Under Code Tools, check NuGet targets & Build Tasks.

See also

Debug custom components
Package a custom component
Add custom components to a field or entity
Updating existing custom components
PowerApps component framework API Reference
PowerApps component framework Overview