While you can build Q# command-line applications in any IDE, however, I would suggest using Visual Studio Code (VS Code) as IDE for your Q# applications. By using the VS Code and the QDK Visual Studio Code extension you gain access to richer functionality and the setup process is simpler for a beginner.
In order to install the Microsoft .net core., currently, it’s version 3.1
The next two-step of install VS Code and the Extension should be straight-forward, I will not waste your time here.
After you have everything installed, then install the Quantum project templates:
- Go to View -> Command Palette, or cmd+shift+p
- Select Q#: Install project templates
You now have the Quantum Development Kit installed and ready to use in your own applications and libraries.
- Go to View -> Command Palette , or cmd+shift+p
- Select Q#: Create New Project
- Select Standalone console application
- Navigate to the location on the file system where you would like to create the application
After that, the VS Code will be reloaded, it might take a few seconds. Then you should see your project folder setting in the
I named my project
Then there’s a bubble poped up at the bottom right corner of VS Code IDE.
- Click on the Open new project… the bubble popped up at the right bottom corner once the project has been created.
VS Code next will download and install all the dependencies for you. The following output should be shown in the
Installing C# dependencies...Platform: darwin, x86_64Downloading package 'OmniSharp for OSX' (47472 KB).................... Done!Validating download...Integrity Check succeeded.Installing package 'OmniSharp for OSX'Downloading package '.NET Core Debugger (macOS / x64)' (41962 KB).................... Done!Validating download...Integrity Check succeeded.Installing package '.NET Core Debugger (macOS / x64)'Downloading package 'Razor Language Server (macOS / x64)' (51065 KB).................... Done!Installing package 'Razor Language Server (macOS / x64)'Finished
If you look at the project files, you should see one file ending with the extension of
.qs, this is your very first quantum code, which is created by VS Code as a template. The file called
Program.qs created, which is a Q# program that defines a simple operation to print a message to the console.
1. Introducing Ozlo
2. How to train a neural network to code by itself ?
3. Paper repro: “Learning to Learn by Gradient Descent by Gradient Descent”
4. Reinforcement Learning for Autonomous Vehicle Route Optimisation
Go to Terminal -> New Terminal and type
$ dotnet run
And you will see the output like this
Hello quantum world!
The code behind the scene is located in the
In the code you see
namespace, which is the keyword used to declare a scope that contains a set of related objects. My project name is
testing123 that is why it showed in the code, yours should be your project name.
You have learned the fastest way to set up a quantum computing environment on your macOS, and “wrote” your first quantum programming code. 🙂
The reference of this article is from https://docs.microsoft.com/en-us/quantum/install-guide/standalone