Develop with Q# applications in an IDE

Learn how to develop Q# applications in Visual Studio Code (VS Code), Visual Studio, or with any editor/IDE and run applications from the .NET console. Q# programs can run on their own, without a driver in a host language like C#, F#, or Python.

Prerequisites for all environments

Installation

While you can build Q# applications in any IDE, we recommend using Visual Studio Code (VS Code) or Visual Studio IDE for developing your Q# applications locally. Developing in these environments leverages the rich functionality of the Quantum Development Kit (QDK) extension, which includes warnings, syntax highlighting, project templates, and more.

Important

If you are working on Linux, you may encounter a missing dependency depending on your particular distribution and installation method (e.g. certain Docker images). Please make sure that the libgomp library is installed on your system, as the GNU OpenMP support library is required by the quantum simulator of the QDK. On Ubuntu, you can do so by running sudo apt install libgomp1, or yum install libgomp on CentOS. For other distributions, please refer to your particular package manager.

Configure the QDK for your preferred environment from one of the following options:

  1. Download and install VS Code 1.52.0 or greater (Windows, Linux and Mac).
  2. Install the QDK for VS Code.

Develop with Q#

Follow the instructions on the tab corresponding to your development environment.

If you are receiving an error "'npm' is not recognized as an internal or external command", in the below steps, install node.js including npm. Alternatively, use our the command line templates to create a Q# project , or use Visual Studio.

To create a new project:

  1. Click View -> Command Palette and select Q#: Create New Project.
  2. Click Standalone console application.
  3. Navigate to the location to save the project. Enter the project name and click Create Project.
  4. When the project is successfully created, click Open new project... in the lower right.

Inspect the project. You should see a source file named Program.qs, which is a Q# program that defines a simple operation to print a message to the console.

To run the application:

  1. Click Terminal -> New Terminal.
  2. At the terminal prompt, enter dotnet run.
  3. You should see the following text in the output window Hello quantum world!

Note

Workspaces with multiple root folders are not currently supported by the VS Code Q# extension. If you have multiple projects within one VS Code workspace, all projects need to be contained within the same root folder.

Next steps

Now that you have installed the Quantum Development Kit in your preferred environment, you can write and run your first quantum program.