Rediger

Get started with GitHub Copilot

GitHub Copilot provides AI-assisted development features in Visual Studio. It suggests lines or blocks of code, answers questions, and assists with development tasks such as writing unit tests, debugging, and profiling. Use these features directly in Visual Studio.

In this article, you learn how to open Copilot and start using its features in Visual Studio.

Open Copilot in Visual Studio

  1. Open Visual Studio.

  2. Create a new project, open an existing project, or continue without code to open the IDE.

  3. Select the GitHub Copilot badge in the upper-right corner of Visual Studio, and then select Open Chat.

    If Copilot isn't installed, select Install Copilot and follow the installer prompts. For more information, see Manage Copilot installation and state.

  4. In the chat window, enter a prompt to start using Copilot.

    If you're not already signed in with a GitHub account, Visual Studio prompts you to sign in. If you don't have a Copilot subscription, get started with Copilot Free. Complete the sign-in or sign-up process in your browser, and then return to Visual Studio.

    Screenshot of the Get Started with Copilot Free dialog in Visual Studio.

Copilot is now ready to use in Visual Studio.

Start using Copilot

After you sign in, use Copilot in the chat window and throughout the IDE.

  • Use the Plan agent: In the chat window, use the agent picker to select Plan and create an implementation plan before making code changes. Copilot explores your codebase with read-only tools, asks clarifying questions when needed, and saves the plan as Markdown in .copilot/plans/.

  • Use agent mode and MCP servers: In the chat window, select Ask and switch to Agent to enable agent mode. Use the tools icon to access Model Context Protocol (MCP) servers, configure servers, and choose which tools Copilot can use. For example, to get Copilot assistance with generating targeted code, send "Write unit tests for the methods in this file."

    • In Visual Studio version 18.1 or later, Copilot Chat can connect to cloud agents to run remote coding sessions that create repository issues and pull requests in your connected GitHub repository. You might be prompted to grant repository permissions the first time you start a cloud session or when more permissions are required.
  • Use built-in agents: Select an agent from the agent picker or enter @ followed by the agent name to get assistance with debugging, profiling, testing, modernization, and other development tasks.

  • Use completions and next edit suggestions: As you code, Copilot provides suggestions directly in the editor. Copilot suggests both new code (shown as gray text) and edits to existing code. By default, Visual Studio prioritizes IntelliSense over Copilot inline completions. Customize keyboard shortcuts for accepting Copilot suggestions in Tools > Options > Environment > Keyboard.

  • Use Copilot actions across Visual Studio: Find Copilot-powered actions and suggestions on the editor context menu, error list, feature search, and other areas of the IDE.

  • Debug with the Debugger Agent: Start the Debugger Agent workflow from Copilot Chat or issue context. Start from a GitHub or Azure DevOps issue or a natural-language prompt to reproduce a problem, generate hypotheses, add instrumentation, analyze telemetry, and apply targeted fixes while validating live runtime behavior.

  • Review selected code: In Visual Studio version 18.8 or later, select code in the editor, select and hold (or right-click) the selection, and then select Copilot Actions > Review Selection. Copilot adds inline review comments and can apply or generate code suggestions. For more information, see Review selected code.

Tailor Copilot chat to your workflow

Customize Copilot for your project and development workflow.

  • Manage context with references: Use the + button to attach more context, such as files or images, or ask Copilot to reference your entire solution.

  • Use the chat history panel to resume sessions: Browse previous conversations and return to a session by title, message preview, or last updated time. For details, see Manage chat history with the Chat History panel.

  • Access different models: Use the model picker in the prompt window to select AI models. Model availability depends on your Copilot plan and, for Copilot Business or Enterprise, your organization's policies.

  • Add custom instructions: Add reusable custom instructions in .github/copilot-instructions.md and prompt files in .github/prompts to customize Copilot responses for your coding style or project needs.

  • Enable built-in .NET and Azure skills: In Visual Studio version 18.8 or later, if you installed a corresponding .NET or Azure workload, open the tool picker, select the Skills tab, and expand Built-in to review the available skills. These skills are off by default, so enable only the ones that apply to your tasks. For more information, see Use built-in .NET and Azure skills.

  • Monitor Copilot usage: In Visual Studio version 18.8 or later, open the Copilot Usage window to view real-time usage metrics and receive alerts when you approach or reach a limit. For details, see Manage Copilot usage and alerts.

  • Apply organization-level custom instructions: In Visual Studio version 18.8 or later, when you work in a repository that belongs to a GitHub organization, Copilot automatically applies instructions defined by the organization owner and lists them in References. For more information, see Use organization-level custom instructions.

  • Create and manage custom agents: In Visual Studio version 18.4 or later, create and select repository-level custom agents. In Visual Studio version 18.5 or later, use the agent picker to create user-level custom agents, which are stored in %USERPROFILE%\.github\agents. For more information, see Use GitHub Copilot agents in Visual Studio.

Helpful resources

To review Copilot features at any time, select GitHub Copilot Walkthrough from the GitHub Copilot badge in the upper-right corner of Visual Studio.

Open Copilot in Visual Studio 2022

  1. Open Visual Studio 2022 version 17.10 or later.

  2. Create a new project, open an existing project, or continue without code to open the IDE.

  3. Select the GitHub Copilot badge in the upper-right corner of Visual Studio, and then select Open Chat Window.

    If Copilot isn't installed, select Install Copilot and follow the installer prompts. For more information, see Manage Copilot installation and state.

  4. In the chat window, enter a prompt to start using Copilot.

    If you're not already signed in with a GitHub account, Visual Studio prompts you to sign in. If you don't have a Copilot subscription, get started with Copilot Free. Complete the sign-in or sign-up process in your browser, and then return to Visual Studio.

    Screenshot of the Get Started with Copilot Free dialog in Visual Studio 2022.

Copilot is now ready to use in Visual Studio 2022.

Start using Copilot

After you sign in, use Copilot in the chat window and throughout the IDE.

  • Use built-in agents: Select Context, GitHub, Profiler, VS, or Workspace from the agent picker, or enter @ followed by the agent name.

  • Use agent mode and MCP servers: In the chat window, select Ask and switch to Agent to enable agent mode. Use the tools icon to access MCP servers, configure servers, and choose which tools Copilot can use.

  • Use completions and next edit suggestions: As you code, Copilot provides suggestions directly in the editor. By default, Visual Studio prioritizes IntelliSense over Copilot inline completions. Customize keyboard shortcuts for accepting Copilot suggestions in Tools > Options > Environment > Keyboard.

  • Use Copilot actions across Visual Studio: Find Copilot-powered actions and suggestions on the editor context menu, error list, feature search, and other areas of the IDE.

Tailor Copilot chat to your workflow

Customize Copilot for your project and development workflow.

  • Manage context with references: Use the + button to attach more context, such as files or images, or ask Copilot to reference your entire solution.

  • Access different models: Use the model picker in the prompt window to select AI models. Model availability depends on your Copilot plan and, for Copilot Business or Enterprise, your organization's policies.

  • Add custom instructions: Add reusable custom instructions in .github/copilot-instructions.md and prompt files in .github/prompts to customize Copilot responses for your coding style or project needs.

Helpful resources

Try building a complete app with the Hands-on lab: GitHub Copilot in Visual Studio 2022.