Update the Microsoft Quantum Development Kit (QDK)

Learn how to update the Microsoft Quantum Development Kit (QDK) to the latest version.

This article assumes that you already have the QDK installed. If you are installing for the first time, then please refer to the installation guide.

Updating Q# Projects

  1. First, install the latest version of the .NET Core SDK 3.0 and run the following command in the command prompt:
dotnet --version

Verify the output is 3.0.100 or higher, then follow the instructions below depending on your setup.

In Visual Studio

  1. Update to the latest version of Visual Studio 2019, see here for instructions
  2. Open your solution in Visual Studio
  3. From the menu, select Build > Clean Solution
  4. Update the target framework in each of your .csproj files to netcoreapp3.0 (or netstandard2.1 if it is a library project)
  5. Save and close all files in your solution
  6. Select Tools > Command Line > Developer Command Prompt
  7. For each project in the solution, run the following command:
dotnet add [project_name].csproj package Microsoft.Quantum.Development.Kit

If your projects use any other Microsoft.Quantum packages, run the command for these too. 8. Close the command prompt and select Build > Build Solution (do not select Rebuild Solution, as rebuilding will initially fail)

In Visual Studio Code

  1. In Visual Studio Code, open the folder containing the project to update
  2. Select Terminal > New Terminal
  3. Follow the instructions for updating using the command line

Using the command line

  1. Navigate to the folder containing your project file
  2. Run the following command:
dotnet clean [project_name].csproj
  1. Update the target framework in each of your .csproj files to netcoreapp3.0 (or netstandard2.1 if it is a library project)
  2. Run the following command:
dotnet add package Microsoft.Quantum.Development.Kit

if your project uses any other Microsoft.Quantum packages, run the command for these too.

  1. Save and close all files
  2. Repeat 1-4 for each project dependency, then navigate back to the folder containing your main project and run:
dotnet build [project_name].csproj

Update IQ# for Python

  1. Update the iqsharp kernel

    dotnet tool update -g Microsoft.Quantum.IQSharp
    dotnet iqsharp install
    
  2. Verify the iqsharp version

    dotnet iqsharp --version
    

    You should see the following output:

    iqsharp: 0.10.1911.307
    Jupyter Core: 1.2.20112.0
    
  3. Update the qsharp package

    pip install qsharp --upgrade
    
  4. Verify the qsharp version

    pip show qsharp
    

    You should see the following output:

    Name: qsharp
    Version: 0.10.1911.307
    Summary: Python client for Q#, a domain-specific quantum programming language
    ...
    
  5. Run the following command from the location of your .qs files

    python -c "import qsharp; qsharp.reload()"
    
  6. You can now use the updated QDK version to run your existing quantum programs.

Update IQ# for Jupyter notebooks

  1. Update the iqsharp kernel

    dotnet tool update -g Microsoft.Quantum.IQSharp
    dotnet iqsharp install
    
  2. Verify the iqsharp version

    dotnet iqsharp --version
    

    You should see the following output:

    iqsharp: 0.10.1911.307
    Jupyter Core: 1.2.20112.0
    
  3. Run the following command from a cell in your Jupyter Notebook:

    %workspace reload
    
  4. You can now open an existing Jupyter notebook and run it with the updated QDK.

Update Visual Studio QDK extension

  1. Update the Q# Visual Studio extension

    Note

    The project templates are updated with the extension. The updated templates apply to newly created projects only. The code for your existing projects is not updated when the extension is updated.

Update VS Code QDK extension

  1. Update the Quantum VS Code extension

    • Restart VS Code
    • Navigate to the Extensions tab
    • Select the Microsoft Quantum Development Kit for Visual Studio Code extension
    • Reload the extension
  2. Update the Quantum project templates:

    • Go to View -> Command Palette
    • Select Q#: Install project templates

C#, using the dotnet command-line tool

  1. Update the Quantum project templates for .NET

    dotnet new -i Microsoft.Quantum.ProjectTemplates
    

What's next?

Now that you have updated the Quantum Development Kit in your preferred environment, you can continue to develop and run your quantum programs. If you have not written a program yet, you can get started with your first quantum program.