Develop with Q# command line applications
Q# programs can be executed on their own, without a driver in a host language like C#, F#, or Python.
While you can build Q# command line applications in any IDE, we recommend using Visual Studio Code (VS Code) or Visual Studio IDE for your Q# applications. Developing in these environments includes the rich functionality of the QDK extension, which includes warnings, syntax highlighting, project templates, and more.
To configure VS Code:
To configure Visual Studio:
- Download and install Visual Studio 16.3 or greater, with the .NET Core cross-platform development workload enabled.
- Download and install the Microsoft QDK.
To install the QDK for another environment, enter in the command line:
dotnet new -i Microsoft.Quantum.ProjectTemplates
Develop with Q#
Follow the instructions at the tab corresponding to your environment.
Install the Q# project templates:
- Open VS Code.
- Click View -> Command Palette.
- Select Q#: Install project templates.
When Project templates installed successfully displays, the QDK is ready to use with your own applications and libraries.
To create a new project:
- Click View -> Command Palette and select Q#: Create New Project.
- Click Standalone console application.
- Navigate to the location to save the project and click Create Project.
- 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:
- Click Terminal -> New Terminal.
- At the terminal prompt, enter
- You should see the following text in the output window
Hello quantum world!
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.
Now that you have installed the Quantum Development Kit in your preferred environment, you can write and run your first quantum program.