К основному содержанию
правило официальный · GitHub

pcf-sample-components — правило для GitHub Copilot: как установить

Направляет GitHub Copilot при сборке, инициализации и тестировании готовых компонентов Power Apps Component Framework из официального репозитория примеров Microsoft.

Установить в GitHub Copilot · Вручную: положить файлы Все способы и платформы ↓
.github/instructions/pcf-sample-components.instructions.md
Открыть на GitHub

Что делает pcf-sample-components

Правило задаёт для GitHub Copilot чёткую инструкцию по развёртыванию компонентов из каталога PowerApps-Samples. Оно применяется к файлам с расширениями .ts, .tsx, .js, .json, .xml, .pcfproj и .csproj. Ассистент подсказывает корректный порядок действий: установку зависимостей через npm install, вызовы msbuild и инициализацию проекта решения через Power Platform CLI.

В инструкцию входит пошаговый процесс упаковки элементов вроде IncrementControl или ChoicesPickerReactControl в архив для импорта в canvas или model-driven приложения. Без установленного Power Platform CLI для Windows и консоли Developer Command Prompt для Visual Studio собрать решение не выйдет.

Какие задачи решает

  • Собрать zip-архив решения с компонентом PCF через MSBuild
  • Инициализировать проект решения командой pac solution init
  • Подвязать ссылку на pcfproj-файл к решению Dataverse
  • Запустить сборку и подготовку зависимостей через npm

Примеры запросов агенту

  • Как инициализировать решение для компонента IncrementControl?
  • Собери zip-пакет с контролом для импорта в make.powerapps.com
  • Помоги связать pcfproj с проектом решения через pac CLI

Как установить pcf-sample-components

Вручную: положить файлы

.github/instructions/pcf-sample-components.instructions.md

Поле applyTo задаёт, к каким файлам применять

По шагам, с командами для каждой платформы: AGENTS.md и CLAUDE.md: что это, кто читает и какой выбрать

Вопросы о pcf-sample-components

Как установить pcf-sample-components в GitHub Copilot?

Сохраните файл правила по пути .github/instructions/pcf-sample-components.instructions.md. Copilot автоматически подключит эти инструкции при работе с файлами подходящих расширений.

Что делает правило pcf-sample-components?

Оно даёт ассистенту пошаговый алгоритм для сборки примеров PCF, привязки контролов к .cdsproj и упаковки готовых решений для Power Apps.

Какие инструменты нужны для выполнения команд правила?

Потребуются операционная система Windows, консоль Developer Command Prompt для Visual Studio, Power Platform CLI (pac) и установленный Node.js.

Исходный текст

pcf-sample-components.instructions.md · MIT
---
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
   ```
   - The generated solution zip file becomes in the `IncrementControlSolution\bin\debug` folder.

10. **Import the solution**
    - Now that you have the zip file, you have two options:
      - Manually [import the solution](https://learn.microsoft.com/powerapps/maker/data-platform/import-update-export-solutions) into your environment using [make.powerapps.com](https://make.powerapps.com/).
      - Alternatively, to import the solution using Power Apps CLI commands, see the [Connecting to your environment](https://learn.microsoft.com/powerapps/developer/component-framework/import-custom-controls#connecting-to-your-environment) and [Deployment](https://learn.microsoft.com/powerapps/developer/component-framework/import-custom-controls#deploying-code-components) sections.

11. **Add components to apps**
    - Finally, to add code components to your model-driven and canvas apps, see:
      - [Add components to model-driven apps](https://learn.microsoft.com/powerapps/developer/component-framework/add-custom-controls-to-a-field-or-entity)
      - [Add components to canvas apps](https://learn.microsoft.com/powerapps/developer/component-framework/component-framework-for-canvas-apps#add-components-to-a-canvas-app)

## Available Sample Components

The repository contains numerous sample components including:

- AngularJSFlipControl
- CanvasGridControl
- ChoicesPickerControl
- ChoicesPickerReactControl
- CodeInterpreterControl
- ControlStateAPI
- DataSetGrid
- DeviceApiControl
- FacepileReactControl
- FluentThemingAPIControl
- FormattingAPIControl
- IFrameControl
- ImageUploadControl
- IncrementControl
- LinearInputControl
- LocalizationAPIControl
- LookupSimpleControl
- MapControl
- ModelDrivenGridControl
- MultiSelectOptionSetControl
- NavigationAPIControl
- ObjectOutputControl
- PowerAppsGridCustomizerControl
- PropertySetTableControl
- ReactStandardControl
- TableControl
- TableGrid
- WebAPIControl

Each sample demonstrates different aspects of the Power Apps component framework and can serve as a learning resource or starting point for your own components.

© github · MIT · github/awesome-copilot

Похожие правила IDE

Все правила IDE по теме «Фронтенд и UI» →

Из того же набора861

Весь набор →
php-symfony Правило задаёт Copilot стиль разработки на Symfony: структура проекта, DI, Doctrine, Twig и тесты. Пригодится, если не хочется объяснять агенту конвенции в каждом чате. ★ 40 418звёзд репо php-mcp-server Инструкция для GitHub Copilot по созданию серверов Model Context Protocol на PHP 8.2+. Помогает ассистенту размечать методы атрибутами и собирать проект через официальный SDK. ★ 40 418звёзд репо performance-optimization Правило помогает находить причины проблем с Core Web Vitals и выбирать исправления для веб-приложения. Пригодится при работе над загрузкой, рендерингом и сдвигами макета. ★ 40 418звёзд репо pcf-tooling Правило подсказывает Copilot, что для сборки, отладки и деплоя код-компонентов нужен Microsoft Power Platform CLI. ★ 40 418звёзд репо pcf-react-platform-libraries Правило помогает создавать React-компоненты PCF с общими библиотеками React и Fluent на платформе Power Apps. Оно пригодится при разработке виртуальных контролов для canvas и model-driven apps. ★ 40 418звёзд репо pcf-overview Задаёт для GitHub Copilot контекст разработки компонентов Power Apps Component Framework. Помогает создавать элементы интерфейса для модельных и холстовых приложений. ★ 40 418звёзд репо pcf-model-driven-apps Подсказывает Copilot, как делать и обновлять code components для model-driven приложений. Срабатывает на ts, tsx, js, json, xml, pcfproj и csproj. ★ 40 418звёзд репо pcf-manifest-schema Правило подсказывает Copilot структуру ControlManifest.Input.xml: какие элементы и атрибуты бывают и что они делают. Пригодится, когда правишь манифест PCF-компонента. ★ 40 418звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой