Getting Started with Microsoft Quantum Computing Programming and Q#


Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js

For developers who want to start working with quantum computing concepts today, Microsoft has released a quantum computing Development Kit. It includes the following items:

  • Native quantum-focused programming language and compiler: Q#
  • A Q# Standard library that contains the Q# quantum algorithms and classic language controls
  • A quantum machine simulator that can be run locally
  • Visual Studio Extensions for Q#
  • Sample code and libraries

You can access this development kit at You also can find it in the Visual Studio Marketplace if you search for the Microsoft Quantum Development Kit.

The developer kit will require you to use a 64-bit version of Windows as well as a newer Intel processor to use the Simulator. Additionally, you'll need to be using Visual Studio 2017 or later. After you've downloaded the file from the URL or accessed the extension from the marketplace, you'll be able to install the necessary extensions into Visual Studio 2017.

Once installed, you should verify that your installation works. To do the verification, copy the sample solution Microsoft has created on GitHub and run the Teleportation Sample. You can clone the example by first going to Team --> Manage Connections in Visual Studio 2017 (See Figure 1).

First step toward cloning a GitHub example
Figure 1: First step toward cloning a GitHub example

In the Connect dialog, select Clone within the Local Git Repository section. In the displayed dialog, enter as the source and press the Clone button, as shown in Figure 2.

The Connect dialog
Figure 2: The Connect dialog

This will clone the files you need. Once completed, you should have a copy of the QSharpLibraries on your local machine that you can load into the Solution Explorer. Select the TeleportationExample, as shown in Figure 3. Right-click TeleportationExample and choose to set it as the startup project.

The QSharpLibraries in Solution Explorer
Figure 3: The QSharpLibraries in Solution Explorer

With the startup project set, run the project (by pressing F5). If all goes well, you should get output similar to what is shown in Figure 4, which shows output from rounds of Teleportation.

Running the Quantum Teleportation tries
Figure 4: Running the Quantum Teleportation tries

Once you've seen this output, you have confirmed that you have successfully installed Q# and the Quantum libraries. You are now set to do Q# programming in Visual Studio!

Quantum Programming

With the Quantum development environment in place, you now should have new project types available under Visual C#. This will include a Q# Application template as well as templates for building a Q# library and a Q# test project, as shown in Figure 5.

The Q# Project types in Visual Studio
Figure 5: The Q# Project types in Visual Studio

When building Q# programs, you'll use a driver program written in C# that constructs the quantum simulator that will execute your Q# code. The driver program also prepares arguments, runs the quantum algorithms, and processes the results of the operations.

You can create a new quantum program from scratch by starting a new project in Visual Studio and then selecting Q# Application. This will give you a default template that will include the C# driver program and more (see Figure 6).

A new Q# Program in Visual Studio
Figure 6: A new Q# Program in Visual Studio

The value of using quantum computing is not to display simple text, so a "Hello World" application in a quantum computing environment is going to be much more complex than displaying text as would be done in a standard "Hello World" application for C# or C++. A "hello world" quantum application is more likely to manipulate numbers and do operations.

Microsoft has provided a relatively simple "hello world" example that can be found at Rather than repeat a similar example here, you should go to the example on that page and work through it. As you work through the example, avoid making minor mistakes. For example, you should note the case of the commands being entered. When working with the X gate, the letter ex is a capital, not a lowercase letter:

let res = M (qubits[0]);

Once you've worked through the "simple" example, you also can dig into the QSharpLibraries examples mentioned earlier in this article. One of the more interesting examples in the library is IntegerFactorization, which shows factorizing an integer. As you'll see by looking at the source code including the Shor.qs file, quantum development is quite a bit more complex than what you'd see with C# or C++!

From Here…

By using Q#, you have a chance to begin familiarizing yourself with the quantum computing concepts that will be coming to future development projects. The value of a quantum computing language isn't going to be achieved on today's computers. The value of this type of programming will happen when there is access to quantum processors. It is the speed gains that will be achieved on such quantum processors that will justify the added coding required to build the apps.

About the Author

Bradley L. Jones

Bradley brings over 25 years of experience in the technology industry to his role as director and Editor in Chief of the Network of sites, which includes, Codeguru, DevX, and HTMLGoodies. In addition to being an 8-time recipient of the Microsoft MVP award, he is an internationally bestselling author who has written more than 20 developer-related books. Bradley continues to connect with the technology industry by publishing applications as well as being involved in the community. Bradley’s past recognition also include producing a top 10 entertainment software product as well as being recognized as a community influencer.

Related Articles


  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date