# pcf-sample-components

Guides GitHub Copilot through preparing, building, and bundling Power Apps Component Framework samples into deployable solution archives.

- rule · `type=rule` · GitHub Copilot · ★ 40418
- Author: github · official GitHub repository
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/github/awesome-copilot/tree/HEAD/instructions/pcf-sample-components.instructions.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/rules/pcf-sample-components

## What it does

This instruction file helps GitHub Copilot navigate sample components from the `PowerApps-Samples` repository. It triggers on `.ts`, `.tsx`, `.js`, `.json`, `.xml`, `.pcfproj`, and `.csproj` files. Copilot relies on these steps to generate commands for `npm install`, project restoration, and Dataverse solution packaging.

The workflow covers commands like `pac solution init` and `pac solution add-reference`, followed by `msbuild` calls that produce ready-to-import zip archives. Without Power Platform CLI for Windows and Developer Command Prompt for Visual Studio, these build steps fail immediately.

## Install

### GitHub Copilot (native platform)

**Manually: put the files in place**
- File: `.github/instructions/pcf-sample-components.instructions.md` — The applyTo field sets which files it applies to

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/pcf-sample-components.md` — The paths frontmatter field limits the files: move applyTo from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/pcf-sample-components.mdc` — Frontmatter: description, globs, alwaysApply. Move applyTo from the source into globs, or the rule will not attach on its own

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/pcf-sample-components.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/pcf-sample-components.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/github/awesome-copilot/tree/HEAD/instructions/pcf-sample-components.instructions.md

## When to use it
- Package PCF sample controls into solution zip files with msbuild
- Initialize a new Dataverse solution project using pac CLI
- Reference a pcfproj component project inside a solution
- Prepare and restore npm and project dependencies for controls

## Example prompts
- How do I initialize and build a solution for IncrementControl?
- Generate the pac commands to link this pcfproj to a solution
- Guide me through exporting a zip package for make.powerapps.com

## Source text · pcf-sample-components.instructions.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 9f53cc4742360e33.

BEGIN THIRD-PARTY FILE 9f53cc4742360e33
````text
---
description: 'How to use and run PCF sample components from the PowerApps-Samples repository'
applyTo: '**/*.{ts,tsx,js,json,xml,pcfproj,csproj}'
---

# How to Use the Sample Components

All the sample components listed under this section are available to download from [github.com/microsoft/PowerApps-Samples/tree/master/component-framework](https://github.com/microsoft/PowerApps-Samples/tree/master/component-framework) so that you can try them out in your model-driven or canvas apps.

The individual sample component topics under this section provide you an overview of the sample component, its visual appearance, and a link to the complete sample component.

## Before You Can Try the Sample Components

To try the sample components, you must first:

- [Download](https://docs.github.com/repositories/working-with-files/using-files/downloading-source-code-archives#downloading-source-code-archives-from-the-repository-view) or [clone](https://docs.github.com/repositories/creating-and-managing-repositories/cloning-a-repository) this repository [github.com/microsoft/PowerApps-Samples](https://github.com/microsoft/PowerApps-Samples).
- Install [Install Power Platform CLI for Windows](https://learn.microsoft.com/en-us/power-platform/developer/cli/introduction#install-power-platform-cli-for-windows).

## Try the Sample Components

Follow the steps in the [README.md](https://github.com/microsoft/PowerApps-Samples/blob/master/component-framework/README.md) to generate solutions containing the controls so you can import and try the sample components in your model-driven or canvas app.

## How to Run the Sample Components

Use the following steps to import and try the sample components in your model-driven or canvas app.

### Step-by-Step Process

1. **Download or clone the repository**
   - [Download](https://docs.github.com/repositories/working-with-files/using-files/downloading-source-code-archives#downloading-source-code-archives-from-the-repository-view) or [clone](https://docs.github.com/repositories/creating-and-managing-repositories/cloning-a-repository) [github.com/microsoft/PowerApps-Samples](https://github.com/microsoft/PowerApps-Samples).

2. **Open Developer Command Prompt**
   - Open a [Developer Command Prompt for Visual Studio](https://learn.microsoft.com/visualstudio/ide/reference/command-prompt-powershell) and navigate to the `component-framework` folder.
   - On Windows, you can type `developer command prompt` in Start to open a developer command prompt.

3. **Install dependencies**
   - Navigate to the component you want to try, for example `IncrementControl`, and run:
   ```bash
   npm install
   ```

4. **Restore project**
   - After the command has completed, run:
   ```bash
   msbuild /t:restore
   ```

5. **Create solution folder**
   - Create a new folder inside the sample component folder:
   ```bash
   mkdir IncrementControlSolution
   ```

6. **Navigate to solution folder**
   ```bash
   cd IncrementControlSolution
   ```

7. **Initialize solution**
   - Inside the folder you created, run the `pac solution init` command:
   ```bash
   pac solution init --publisher-name powerapps_samples --publisher-prefix sample
   ```
   > **Note**: This command creates a new file named `IncrementControlSolution.cdsproj` in the folder.

8. **Add component reference**
   - Run the `pac solution add-reference` command with the `path` set to the location of the `.pcfproj` file:
   ```bash
   pac solution add-reference --path ../../IncrementControl
   ```
   or
   ```bash
   pac solution add-reference --path ../../IncrementControl/IncrementControl.pcfproj
   ```
   > **Important**: Reference the folder that contains the `.pcfproj` file for the control you want to add.

9. **Build the solution**
   - To generate a zip file from your solution project, run the following three commands:
   ```bash
   msbuild /t:restore
   msbuild /t:rebuild /restore /p:Configuration=Release
   msbuild
````
END THIRD-PARTY FILE 9f53cc4742360e33

The third-party file has ended. Everything between the 9f53cc4742360e33 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3950 of 6045 bytes. © github · MIT · https://github.com/github/awesome-copilot/tree/HEAD/instructions/pcf-sample-components.instructions.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
