Installing and Validating the Q# Development Environment

Required Prerequisites

  • A 64-bit installation of Windows, macOS, or Linux. (the Microsoft Quantum Development Kit has been tested under Ubuntu Linux, but may work on other distributions).
  • The .NET Core SDK 2.0 or later.

Optional Prerequisites

If you do not have Visual Studio installed, you can download Visual Studio 2017 Community Edition for free.

  1. Go to the Visual Studio download page.
  2. Click on the Visual Studio Community Free download button.
  3. Navigate to your browser's download folder and double click on the executable file whose name begins with vs_community. The file name will contain a sequence of numbers that varies.
  4. Important!  When you are presented with the option to select the tools for specific workloads, check the box for .NET Core cross-platform development. If there are any other workloads you would like to install, you can select them as well at this step.
  5. After selecting your workloads, click Install to complete the installation.

Installing and Validating the Q# Development Environment

In this section you will clone the quantum samples & libraries repository, and run a sample application to verify that your Q# environment is correctly installed and configured.

  1. Install the Microsoft Quantum Development Kit extension.

    Note

    Microsoft Quantum Development Kit does not support Visual Studio for Mac. For development on macOS, we recommend Visual Studio Code.

  2. Clone and open the Microsoft Quantum Developer Kit Samples and Libraries GitHub repository.

    1. Open Visual Studio.
    2. Open the Connect view in Team Explorer (Team > Manage Connections)
    3. Select Clone under Local Git Repositories and enter https://github.com/Microsoft/Quantum.git
    4. Click Clone to clone the repo.
    5. The repository will be cloned on your local computer and Visual Studio will switch to the Solution Explorer on the right populated with the libraries and samples.
    6. Open the QsharpLibraries.sln solution.
      • If prompted by the Install Missing Features pane, click Install to allow the installation of the necessary features. This is most often F# and tools used by some of the samples.
    7. (Optional) To install libraries for non-commercial use, navigate to Microsoft/Quantum-NC on GitHub. Then clone the repository and open the Quantum-NC.sln solution.
  3. Validate your Q# environment by running the teleport sample program:

    1. Right click on the TeleportationSample project in Samples > 0.Introduction folder of QsharpLibraries solution, and left click on "Set as Startup Project".
    2. Run the solution (F5.)

Tip

If you receive a number of errors that reference NuGet packages, use the procedures in NuGet package restore to restore the packages.

If the program runs and the output is similar to the following (has 8 rounds of successful teleportation with varying values True/False sent each round), your Q# environment is ready to support Q# development.

        Round 0:        Sent True,      got True.
        Teleportation successful!!
        Round 1:        Sent False,     got False.
        Teleportation successful!!
        ...
        Round 6:        Sent True,      got True.
        Teleportation successful!!
        Round 7:        Sent False,     got False.
        Teleportation successful!!