How to Install Copilot in Visual Studio

No comments
Last Reviewed:

Are you feeling bogged down by repetitive coding tasks? Do you want to explore new languages without diving into endless documentation?

This guide will walk you through how to install GitHub Copilot in Visual Studio.

Before You Start

For this article, here’s what I needed to install GitHub Copilot in Visual Studio.

  • Deploy Visual Studio on my computer.
  • Create a GitHub account.
  • Sign into Visual Studio with an active GitHub Copilot subscription to a 30-day free trial.

Note: GitHub Copilot is available for Visual Studio 2022 17.8.0 and later versions only.

How To Install Copilot in Visual Studio 2022

Besides Copilot, GitHub offers a chat feature. Visual Studio 2022 versions 17.10.0 Preview 3 and later have one extension for both, while the earlier version requires installing the two separately. It’s why the steps are different in each case.

I installed the latest version 17.10.0 Preview 7.

Visual Studio 2022 version 17.10.0 Preview 3 or Later

Installing the GitHub Copilot extension also gives you access to GitHub Copilot Chat.

1. Download and install Visual Studio 17.10 Preview 7.0 (or the latest available version).

2. Sign in with a Microsoft account.

3. Open the Visual Studio Installer. Select at least one workload on the Workloads tab. The right pane should show GitHub Copilot as selected. Or go to Individual Components, select GitHub Copilot and click Install.

To modify workloads or components, open this window by launching the Visual Studio Installer from the Windows Start menu. Click Modify, make the changes and click Modify again.

4. Select Launch to open Visual Studio 2022.

Visual Studio Installer with Visual Studio Community 2022 Preview Installed

5. On the next screen, click Continue without code.

Getting Started with Visual Studio Continue Without Code Option

6. Go to GitHub Copilot on the top right.

7. Click Add GitHub Account with a Copilot Subscription.

Visual Studio Extension Manger with Add GitHub Account with Copilot Subscription Marked

8. Go to File > Account Settings to display the dialog box. Click the +Add⏷ drop-down and select GitHub to give Visual Studio access to your GitHub account.

Add GitHub Account to Visual Studio

9. Visual Studio redirects you to the browser, where you can sign in to GitHub.

Visual Studio Authorizations to GitHub

10. Your web browser will prompt you to sign in with your GitHub username and password. Once you successfully sign in, a confirmation window will appear in your browser.

11. Open Visual Studio and click Launch to start coding with GitHub Copilot and GitHub Copilot Chat. A green checkmark indicates Copilot is active.

12. To see GitHub Copilot in action, I created a new project and clicked on the GitHub Copilot icon. The following screenshot shows how GitHub Copilot suggests the next line of code when I define the variables for the first and last names.

GitHub Copilot In Action in Visual Studio

Visual Studio 2022 versions 17.8.0 and 17.9.0

For versions 17.8.0 and 17.9.0, you need to install the GitHub Copilot and GitHub Copilot Chat extensions separately.

There are three ways you can do this.

Let’s go.

Using the Extension Manager

1. Sign in to Visual Studio with your Microsoft credentials.

2. Open the Visual Studio Installer and click Launch.

3. On the next screen, select Continue without code.

4. In the File menu, go to Extensions > Manage Extensions. It’s fairly easy to scroll down the extensions list and find what you need.

5. Select GitHub Copilot and click Download. In the same way, find Copilot Chat and download it.

GitHub Copilot Extension in Visual Studio

6. Close the Manage Extensions popup, then restart Visual Studio to complete the installation.

7. Open Manage Extensions again and click Installed. You should see GitHub Copilot among the installed extensions.

8. Open an existing project or create a new one and start using GitHub Copilot and GitHub Copilot Chat.

  • Press the Tab button to accept a suggestion from Copilot.
  • Use Alt + . or Alt + to see the various recommendations.
  • Press Esc to reject a suggestion.

Refer to this documentation for configuring GitHub Copilot.

Here’s another helpful resource for generating code suggestions from comments.

Enabling/Disabling GitHub Copilot

For Visual Studio 2022 versions 17.8 and 17.9, go to File > Extensions > Manage Extensions > Installed and click Disable on the GitHub Copilot bar.

Extension Management in Visual Studio with GitHub Copilot Highlighted

Optionally, toggle the GitHub Copilot icon on the status bar to enable/disable it. If it’s active, it’ll show a green check mark.

FAQs

Case 1: It’s uninstalled, but the icon shows in Visual Studio.

It can happen if you have removed the checkmark next to GitHub Copilot in the Installer. You’ll need to deploy it from the Installer or the Extension Manager.

Case 2: It’s installed but unavailable for use.

It can happen due to internet connectivity or server issues. If it’s a sync issue, you might have to wait and select Refresh your Copilot credentials.

Case 3: It might be inactive.

You might not have signed in to GitHub or not have an active GitHub Copilot subscription. Sign in to GitHub with an account that has an active GitHub Copilot subscription.

You either don’t have a GitHub Copilot subscription, or Visual Studio failed to connect to the GitHub API for GitHub Copilot.

Try signing out from GitHub Copilot in Visual Studio. Then, sign in to request a new token from api.github.com.

Concluding Thoughts

GitHub Copilot is a plug-and-play AI assistant that will save you a ton of time while coding. As Google joins the game with Duet AI, the future of coding looks even brighter. Expect faster development and more powerful tools to create amazing things!

Do you have any questions about how to install Copilot in Visual Studio? Ask us in the comments!

Trending Articles

Ritinder KaurHow to Install Copilot in Visual Studio

Leave a Reply

Your email address will not be published. Required fields are marked *