Quantum Development Kits adopts .NET6 and supports Visual Studio 2022

Ricardo Espinoza

In March’s Quantum Development Kit (QDK) release 0.24, we updated the QDK to use and require .NET 6.0 instead of .NET Core 3.1. This change will enable a simpler onboarding experience for new users, allow us to offer an extension for Visual Studio 2022, and enable our contributors to leverage new features available in C# 10.

We want to share with you our motivation for this change, as well as some additional details and guidance when migrating old Q# projects into a new version of the QDK.

 

.NET support policy and QDK adoption of new .NET versions

According to the official .NET support policy, there is a distinction between two types of releases:

.NET LTS versions are supported for 3 years, and Current versions for 1.5 years

  • Long Term Support (LTS) releases are supported for three years after initial release. The following LTS versions are currently supported:
    • .NET 6, released in November 2021, supported until November 2024.
    • .NET Core 3.1, released in December 2019, supported until November 2022.
  • Current releases are supported for 6 months after a subsequent Current or LTS release which happens every year, for a total support period of 18 months. The only supported version of this type is:
    • .NET 5, released in November 2020, supported until May 2022.

The last time we updated the Quantum Development Kit to a new .NET version was in January 2020 when we adopted the just released .NET Core 3.1. Since then, we made the decision to stay in the LTS version and not migrate into Current releases, which have a shorter support period. This provides stability and avoids possible disruptions when migrating from one version to another while at the same time. It also ensures that the QDK runs on a fully supported .NET release.

 

What is new?

In November of 2021, .NET6 was released as a new LTS and it was time to adopt it in the QDK. Starting from version 0.24, the extensions have been updated to create .NET6 projects, we also updated our samples and templates, the Quantum Katas, re-targeted our language server, compiler, runtime and other components.

At the same time, Visual Studio 2022 was released and is now the default version that you’ll get at the download page, so we decided to add support for it too. Because the extensions are not compatible with older versions of Visual Studio, we published a new extension for Visual Studio 2022.

Download page for Visual Studio 2022 extension

If you use Visual Studio 2019, you can still find our previous extension of the Quantum Development Kit; however, we are no longer updating it and the last available version is 0.23.195983.

If you are a Visual Studio Code user, you can continue using the same extension, and just update automatically or manually to a 0.24.201332 or newer version.

 

Migrating existing Q# projects

Both the Visual Studio Code and Visual Studio extensions create Q# projects targeting the NuGet packages and .NET framework consistent with its version. It’s also possible to open projects created with previous versions, and the compilation will fetch the right packages depending on the version of the SDK referenced by each project.

If you have an older project that references an previous version of the QDK you can continue using it as is with the Visual Studio Code and Visual Studio 2019 extensions; however, you might also want to manually update those Q# projects to a newer version of the Quantum Development Kit to benefit from newer features or if you have migrated to Visual Studio 2022.

For application and test projects, this can be done by editing the .csproj file, and if you do this, don’t forget to update the .NET version accordingly. For example, let’s consider the following legacy project:

<Project Sdk="Microsoft.Quantum.Sdk/0.23.195983">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
</Project>

 

In order to use a newer QDK version, then the target framework should be updated too:

<Project Sdk="Microsoft.Quantum.Sdk/0.24.208024">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>
</Project>

 

In addition to those, you’ll notice that we also have library projects that use netstandard2.1, as shown below:

<Project Sdk="Microsoft.Quantum.Sdk/0.24.208024">
  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>
</Project>

 

Migrating library projects to net6.0 is possible but not required. Be aware that a netstandard2.1 project cannot depend on a net6.0 one, but the opposite is supported.

 

Call to Action

We invite you to try the new version of the extensions of the QDK and reach out to our team and the user community if you need support. You can do this by opening issues in this GitHub repository or posting questions in Stack Overflow.

Thanks for using Azure Quantum and the Quantum Development Kit!