Visual Studio With GitHub Copilot – AI Pair Programming2024-10-08T11:04:04-07:00

Latest Visual Studio 2022 with GitHub Copilot woven in

Spend more time on code that matters, with your AI pair programmer now seamlessly integrated.

Get started in just 3 steps

GitHub Copilot installation screenshot

Install latest version of Visual Studio 2022

GitHub Copilot’s latest experience is integrated into Visual Studio and combines the capabilities of GitHub Copilot’s code completion and GitHub Copilot Chat into one convenient package. Download the latest Visual Studio 2022 to discover the new features and improvements.

GitHub Copilot installation screenshot

Sign up for free trial

GitHub Copilot is free for verified students and for maintainers of popular open-source projects on GitHub. If you’re not a student or a maintainer of a popular open-source project, you can try GitHub Copilot for free with a one-time 30-day trial.

Github Copilot sign in screenshot

Sign in with your GitHub account

To enable GitHub Copilot, ensure you have added your GitHub account to Visual Studio. For more information, see  Work with GitHub accounts in Visual Studio in the Microsoft documentation.

5 tips and tricks

01
Best practices

GitHub Copilot is a coding assistant powered by Artificial Intelligence (AI), which can run in various environments and help you be more efficient in your daily coding tasks. In this new series of content, we will show you how GitHub Copilot works in Visual Studio specifically and how it helps you being more productive.

02
Prompt like a pro

The quality of the output of any Large Language Model depends largely on the quality of the prompt, and GitHub Copilot is no exception. In this new video, Gwyn teaches about “prompt engineering” for GitHub Copilot in Visual Studio 2022, and how to create better results with better prompts.

03
Code completions

Start writing in the editor and Copilot will suggest code as you type.
Tip: press “tab” to accept a suggestion.

04
Inline chat

Use Inline Chat will help you write your methods, classes, unit tests by converting your prompts to code. Open Inline by right-clicking in your text file and selecting “Ask Copilot” or Alt + /`
Tip: Use”/” to state your intent or “#” to refer to your files(s). Like “/test for #filename”

05
Chat window

Ask questions about your solution or files.  Open from the Copilot Badge or CTRL + /, C.
Tip: Use #solution to refer to your active solution (only for C#) in Visual Studio

Don’t fly solo

Developers all over the world use GitHub Copilot to code faster, focus on business logic over boilerplate, and do what matters most: building great software.

Copilot Individual

For individual developers, freelancers, students, and educators that want to code faster and happier.

$10USDper month / $100 USD per year

Start a free trial
Free for verified students, teachers, and maintainers of popular open source projects.
What’s included

Chat

  • Unlimited messages and interactions
  • Context-aware coding support and explanations
  • Debugging and security remediation assistance
  • Access to knowledge from top open source repositories
  • Pull request diff analysis
  • Web search powered by Bing (Public beta)
  • Ability to ask about a failed Actions jobs (Public Beta)
  • Answers about issues, PRs, discussions, files, commits etc.

Code completion

  • Real time code suggestions
  • Comments to code

Customization

  • Tailor chat conversations to your private codebase (up to 5/50/unlimited repos)²
  • Unlimited integrations with Copilot Extensions (Public Beta)
  • Build a private extension for internal tooling (Public Beta)
  • Attach knowledge bases to chat for organizational context
  • Fine-tuned models for code completion (coming soon as add-on)

AI-native experiences

  • Inline chat and prompt suggestions
  • Slash commands and context variables
  • Commit message generation
  • Pull request summary generation

Supported environments

  • IDE, CLI and GitHub Mobile
  • GitHub.com

Management and policies

  • Public code filter with code referencing
  • User management
  • Data excluded from training by default
  • Enterprise-grade security
  • IP indemnity
  • Content exclusion
  • SAML SSO authentication1
  • Requires GitHub Enterprise Cloud
  • Usage metrics

Most popular

Copilot Business

For organizations ready to improve engineering velocity, code quality, and developer experience.

$19USDper user / month

What’s included

Chat

  • Unlimited messages and interactions
  • Context-aware coding support and explanations
  • Debugging and security remediation assistance
  • Access to knowledge from top open source repositories
  • Pull request diff analysis
  • Web search powered by Bing (Public beta)
  • Ability to ask about a failed Actions jobs (Public Beta)
  • Answers about issues, PRs, discussions, files, commits etc.

Code completion

  • Real time code suggestions
  • Comments to code

Customization

  • Tailor chat conversations to your private codebase (up to 5/50/unlimited repos)²
  • Unlimited integrations with Copilot Extensions (Public Beta)
  • Build a private extension for internal tooling (Public Beta)
  • Attach knowledge bases to chat for organizational context
  • Fine-tuned models for code completion (coming soon as add-on)

AI-native experiences

  • Inline chat and prompt suggestions
  • Slash commands and context variables
  • Commit message generation
  • Pull request summary generation

Supported environments

  • IDE, CLI and GitHub Mobile
  • GitHub.com

Management and policies

  • Public code filter with code referencing
  • User management
  • Data excluded from training by default
  • Enterprise-grade security
  • IP indemnity
  • Content exclusion
  • SAML SSO authentication1
  • Requires GitHub Enterprise Cloud
  • Usage metrics

New

Copilot Enterprise

For companies looking to customize GitHub Copilot to their organization and infuse AI across the developer workflow.

$39USDper user / month

What’s included

Chat

  • Unlimited messages and interactions
  • Context-aware coding support and explanations
  • Debugging and security remediation assistance
  • Access to knowledge from top open source repositories
  • Pull request diff analysis
  • Web search powered by Bing (Public beta)
  • Ability to ask about a failed Actions jobs (Public Beta)
  • Answers about issues, PRs, discussions, files, commits etc.

Code completion

  • Real time code suggestions
  • Comments to code

Customization

  • Tailor chat conversations to your private codebase (up to 5/50/unlimited repos)²
  • Unlimited integrations with Copilot Extensions (Public Beta)
  • Build a private extension for internal tooling (Public Beta)
  • Attach knowledge bases to chat for organizational context
  • Fine-tuned models for code completion (coming soon as add-on)

AI-native experiences

  • Inline chat and prompt suggestions
  • Slash commands and context variables
  • Commit message generation
  • Pull request summary generation

Supported environments

  • IDE, CLI and GitHub Mobile
  • GitHub.com

Management and policies

  • Public code filter with code referencing
  • User management
  • Data excluded from training by default
  • Enterprise-grade security
  • IP indemnity
  • Content exclusion
  • SAML SSO authentication1
  • Requires GitHub Enterprise Cloud
  • Usage metrics

1: Authentication with SAML single sign-on (SSO) available for organizations using GitHub Enterprise Cloud.
2: Feature in public beta for Copilot Individual and Business plans. Requires use of repositories, issues, discussions, Actions, and other features of GitHub.

Learn about GitHub Copilot Terms and Conditions.

FAQ

Visual Studio 2022 version 17.10 or later

  1. Download the latest version of Visual Studio 2022. Select at least one workload in the installer. Make sure to leave the preselected component GitHub Copilot selected. OR If no workload is selected, install GitHub Copilot by selecting it from Individual components in the installer.
  2. Set up a GitHub Copilot subscription for your personal account, or if you are a member of an organization or enterprise with a GitHub Copilot subscription you will need to be assigned a seat by an organization owner. Before starting a paid subscription for a personal account, you can set up a one-time 30-day trial to evaluate GitHub Copilot. To begin a trial, you will need to choose a monthly or yearly billing cycle, and provide a payment method. If you do not cancel the trial before the end of the 30 days, the trial will automatically convert to a paid subscription.You can cancel your GitHub Copilot trial at any time during the 30 days and you won’t be charged. If you cancel before the end of the trial, you will continue to have access to GitHub Copilot until the 30-day trial period ends. For more information, see Managing your GitHub Copilot Individual subscription.
  3. Sign into Visual Studio with a GitHub account that has a GitHub Copilot subscription. Follow the steps in Add GitHub accounts to your Visual Studio keychain.

For more details visit the learn.microsoft.com Install and manage GitHub Copilot in Visual Studio documentation page.

With Visual Studio 2022 version 17.10 or later, GitHub Copilot and GitHub Copilot Chat are available to install as a single extension that combines both Copilot and Copilot Chat into one package. The unified GitHub Copilot extension is included as a built-in, recommended component by default in all workloads and is available through the Visual Studio Installer.

To get the new unified GitHub Copilot extension:

  • Install Visual Studio 2022 version 17.10 or later.
  • Select at least one workload in the installer. Make sure to leave the preselected component GitHub Copilot selected. OR If no workload is selected, install GitHub Copilot by selecting it from Individual components in the installer.

GitHub Copilot is installed by default with all workloads. If you choose to exclude it, you can install it later by using the Visual Studio Installer to modify your installation, and selecting the GitHub Copilot component.

For more details visit the learn.microsoft.com GitHub Copilot in Visual Studio install documentation page.

With Visual Studio 2022 version 17.10 and later, you see a Copilot status icon in the upper-right corner of the Visual Studio environment that indicates if Copilot is active, inactive, unavailable, or not installed. Using the dropdown menu from the status icon, you can easily access options that help manage or troubleshoot your Copilot state. Some options are available or greyed out depending on your Copilot state.

See Manage your Copilot state for more information.

Visual Studio 2022 version 17.9 or earlier

In Visual Studio 2022 versions 17.8 to 17.9, GitHub Copilot and GitHub Copilot Chat are available to install as two separate extensions. Installing GitHub Copilot extension is a prerequisite to installing GitHub Copilot Chat.

Follow the steps in Get GitHub Copilot for Visual Studio 2022 versions 17.8 to 17.9.

To enable GitHub Copilot, ensure you have added your GitHub account to Visual Studio. For more information, see Add GitHub accounts to your Visual Studio keychain.
You can get better answers by providing more information to GitHub Copilot Chat including:

  • Use slash commands to quickly specify common tasks like /explain to get code explanations.
  • Scope the chat to specific files using references.
  • Review the source used by Copilot to generate the answer.
  • Use different threads for each of your Copilot chats so you can maintain different contexts in each.

Learn more about how to use Copilot Chat in Visual Studio.

Learn more about Troubleshooting common issues with GitHub Copilot.

You can also keep track of conversations surrounding GitHub Copilot through GitHub’s discussion forum.

No, GitHub Copilot is a separate subscription and is not included with a Visual Studio Professional or Enterprise license.

Learn more about billing for GitHub Copilot.

GitHub Copilot transforms the developer experience. Backed by the leaders in AI, Copilot provides contextualized assistance throughout the software development lifecycle, from code completions and chat assistance in the IDE to code explanations and answers to docs in GitHub and more. With Copilot elevating their workflow, developers can focus on more: value, innovation, and happiness.

GitHub Copilot enables developers to focus more energy on problem solving and collaboration and spend less effort on the mundane and boilerplate. That’s why developers who use Copilot report higher satisfaction with their jobs than those who don’t and are up to 55% more productive at writing code without sacrifice to quality, which all adds up to engaged developers shipping great software faster. Without sacrifice to quality, which all adds up to engaged developers shipping great software faster.

GitHub Copilot integrates with leading editors, including Visual Studio Code, Visual Studio, JetBrains IDEs, and Neovim, and, unlike other AI coding assistants, is natively built into GitHub. Growing to millions of individual users and tens of thousands of business customers, Copilot is the world’s most widely adopted AI developer tool and the competitive advantage developers ask for by name.

For more information about the general use of GitHub Copilot, product impact, human, oversight, and privacy, see the comprehensive list of GitHub Copilot FAQs.

GitHub Copilot is trained on all languages that appear in public repositories. For each language, the quality of suggestions you receive may depend on the volume and diversity of training data for that language. For example, JavaScript is well-represented in public repositories and is one of GitHub Copilot’s best supported languages. Languages with less representation in public repositories may produce fewer or less robust suggestions.

For more information about the general use of GitHub Copilot, product impact, human, oversight, and privacy, see the comprehensive list of GitHub Copilot FAQs.

GitHub Copilot is powered by generative AI models developed by GitHub, OpenAI, and Microsoft. It has been trained on natural language text and source code from publicly available sources, including code in public repositories on GitHub.

For more information about the general use of GitHub Copilot, product impact, human, oversight, and privacy, see the comprehensive list of GitHub Copilot FAQs.

No, GitHub Copilot generates suggestions using probabilistic determination.

When thinking about intellectual property and open source issues, it is critical to understand how GitHub Copilot really works. The AI models that create Copilot’s suggestions may be trained on public code, but do not contain any code. When they generate a suggestion, they are not “copying and pasting” from any codebase.

  • To generate a code suggestion, the Copilot extension begins by examining the code in your editor—focusing on the lines just before and after your cursor, but also information including other files open in your editor and the URLs of repositories or file paths to identify relevant context. That information is sent to Copilot’s model, to make a probabilistic determination of what is likely to come next and generate suggestions.
  • To generate a suggestion for chat in the code editor, the Copilot extension creates a contextual prompt by combining your prompt with additional context including the code file open in your active document, your code selection, and general workspace information, such as frameworks, languages, and dependencies. That information is sent to Copilot’s model, to make a probabilistic determination of what is likely to come next and generate suggestions.
  • To generate a suggestion for chat on GitHub.com, such as providing an answer to a question from your chat prompt, Copilot creates a contextual prompt by combining your prompt with additional context including previous prompts, the open pages on GitHub.com as well as retrieved context from your codebase or Bing search. That information is sent to Copilot’s model, to make a probabilistic determination of what is likely to come next and generate suggestions.

For more information about the general use of GitHub Copilot, product impact, human, oversight, and privacy, see the comprehensive list of GitHub Copilot FAQs.

GitHub Copilot processes personal data based on how Copilot is accessed and used: whether via github.com, mobile app, extensions, or one of various IDE extensions, or through features like suggestions for the command line interface (CLI), IDE code completions, or personalized chat on GitHub.com. The types of personal data processed may include:

  • User Engagement Data: This includes pseudonymous identifiers captured on user interactions with Copilot, such as accepted or dismissed completions, error messages, system logs, and product usage metrics.
  • Prompts: These are inputs for chat or code, along with context, sent to Copilot’s AI to generate suggestions.
  • Suggestions: These are the AI-generated code lines or chat responses provided to users based on their prompts.
  • Feedback Data: This comprises real-time user feedback, including reactions (e.g., thumbs up/down) and optional comments, along with feedback from support tickets.

For more information about the general use of GitHub Copilot, product impact, human, oversight, and privacy, see the comprehensive list of GitHub Copilot FAQs.

How GitHub uses Copilot data depends on how the user accesses Copilot and for what purpose. Users can access GitHub Copilot through the web, extensions, mobile apps, computer terminal, and various IDEs (Integrated Development Environments). GitHub generally uses personal data to:

  • Deliver, maintain, and update the services as per the customer’s configuration and usage, to ensure personalized experiences and recommendations
  • Troubleshoot, which involves preventing, detecting, resolving, and mitigating issues, including security incidents and product-related problems, by fixing software bugs and maintaining the online services’ functionality and up-to-dateness
  • Enhance user productivity, reliability, effectiveness, quality, privacy, accessibility, and security by keeping the service current and operational

These practices are outlined in GitHub’s Data Protection Agreement (DPA), which details our data handling commitments to our data controller customers.

GitHub also uses certain personal data with customer authorization under the DPA, for the following purposes:

  • Billing and account management
  • To comply with and resolve legal obligations
  • For abuse detection, prevention, and protection, virus scanning, and scanning to detect violations of terms of service
  • To generate summary reports for calculating employee commissions and partner incentives
  • To produce aggregated reports for internal use and strategic planning, covering areas like forecasting, revenue analysis, capacity planning, and product strategy

For details on GitHub’s data processing activities as a controller, particularly for Copilot Individual customers, refer to the GitHub Privacy Statement.

The primary IP considerations for GitHub Copilot relate to copyright. The model that powers Copilot is trained on a broad collection of publicly accessible code, which may include copyrighted code, and Copilot’s suggestions (in rare instances) may resemble the code its model was trained on. Here’s some basic information you should know about these considerations:

Copyright law permits the use of copyrighted works to train AI models: Countries around the world have provisions in their copyright laws that enable machines to learn, understand, extract patterns, and facts from copyrighted materials, including software code. For example, the European Union, Japan, and Singapore, have express provisions permitting machine learning to develop AI models. Other countries including Canada, India, and the United States also permit such training under their fair use/fair dealing provisions. GitHub Copilot’s AI model was trained with the use of code from GitHub’s public repositories—which are publicly accessible and within the scope of permissible copyright use.

What about copyright risk in suggestions? In rare instances (less than 1% based on GitHub’s research), suggestions from GitHub may match examples of code used to train GitHub’s AI model. Again, Copilot does not “look up” or “copy and paste” code, but is instead using context from a user’s workspace to synthesize and generate a suggestion.

Our experience shows that matching suggestions are most likely to occur in two situations: (i) when there is little or no context in the code editor for Copilot’s model to synthesize, or (ii) when a matching suggestion represents a common approach or method. If a code suggestion matches existing code, there is risk that using that suggestion could trigger claims of copyright infringement, which would depend on the amount and nature of code used, and the context of how the code is used. In many ways, this is the same risk that arises when using any code that a developer does not originate, such as copying code from an online source, or reusing code from a library. That is why responsible organizations and developers recommend that users employ code scanning policies to identify and evaluate potential matching code.

In Copilot, you can opt whether to allow Copilot to suggest code completions that match publicly available code on GitHub.com. For more information, see “Configuring GitHub Copilot settings on GitHub.com”. If you have allowed suggestions that match public code, GitHub Copilot can provide you with details about the matching code when you accept such suggestions. Matching code does not necessarily mean copyright infringement, so it is ultimately up to the user to determine whether to use the suggestion, and what and who to attribute (along with other license compliance) in appropriate circumstances.

For more information about the general use of GitHub Copilot, product impact, human, oversight, and privacy, see the comprehensive list of GitHub Copilot FAQs.

Start a free trial of GitHub Copilot

Feedback