Edit

Share via


Get started with GitHub Copilot

Welcome to GitHub Copilot, your AI companion in Visual Studio!

Copilot helps you code faster and with greater accuracy by suggesting entire lines or blocks of code, answering questions, and assisting with routine tasks such as writing unit tests, debugging and profiling — all directly in your Visual Studio environment.

In this article you learn how to use Copilot and make the most of its features in Visual Studio.

Launch Copilot

  1. Launch Visual Studio (version 17.8 or later).
    It's recommended to update to the latest version of Visual Studio to get the most out of Copilot.

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

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

    Screenshot shwoing the GitHub Copilot badge in Visual Studio.

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

  4. In the Chat window, choose to sign in with your existing GitHub account or Sign up for Copilot Free. Follow the prompts in your browser to complete the sign-in or sign-up process. After you finish, return to Visual Studio to continue using Copilot.

Copilot is now ready to use in Visual Studio!

Start using Copilot

Once you're signed in, you can use Copilot in the Chat window and throughout the IDE.

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

  • Use Completions and Next Edit Suggestions: As you code, Copilot provides suggestions directly in the editor. Copilot will suggest both new code(shown as gray text) and edits to existing code.

  • Use Copilot actions across Visual Studio: Find Copilot-powered actions and suggestions in 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 your development workflow.

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

  • Access different models: Use the model picker in the prompt window to select AI models, or bring your own model to Copilot! Explore different models for different scenarios, whether it's answering quick questions, writing documentation, or generating multi-file code edits.

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

Next steps

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

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