0

I am running the current latest version of Visual Studio Code on POP_OS (Ubuntu 22.04 LTS) and have installed all requirements to get Q# running on my machine:

I have installed the SDK following Microsoft official guide to get it running on Linux:

wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb 
sudo dpkg -i packages-microsoft-prod.deb 
rm packages-microsoft-prod.deb

sudo apt-get update; \ sudo apt-get install -y apt-transport-https && \ sudo apt-get update && \ sudo apt-get install -y dotnet-sdk-6.0

With all this present, I am able to run

dotnet new console -lang Q# --name test

I can navigate to the folder named test and run

dotnet run

Which prints the expected

Hello Quantum World!

message.

So Q# and the SDK seem properly installed.

But whenever I open the Program.qs file in VS Code I get red squiggly lines over all the open statements with the error message

No namespace with the name "Microsoft.Quantum.Canon" exists.

I have installed all required plugins like the Microsoft Quantum Development Kit and C#. Debugging the code works without issue. I can place breakpoints etc.

The .csproj file looks like this:

<Project Sdk="Microsoft.Quantum.Sdk/0.24.210930">

<PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net6.0</TargetFramework> </PropertyGroup>

</Project>

And the Program.qs file like this

namespace test {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;


@EntryPoint()
operation HelloQ() : Unit {
    Message(&quot;Hello quantum world!&quot;);
}

}

The same question asked here: Q#/VS: No namespace with the name "Microsoft.Quantum.Canon" exists Suggested it might be due to a Nuget Package error.

So I ran

dotnet nuget locals --clear all

and rebooted VSCode. Rebooted the computer. Even re-installed everything from scratch. But I'm still getting the Intellisense errors all of a sudden.

So what am I missing here, what else can I possibly try to get this to work again?

Matthias
  • 111
  • 2
  • 4
    I’m voting to close this question because it is not about quantum computing but a software instalation issue. – Martin Vesely Jun 16 '22 at 17:23
  • Could you go to the extension logs using this strategy and post any output from the QDK extension? (If they close your question, I encourage you to post a bug on github: https://github.com/microsoft/qsharp-compiler/issues) – Austin Adams Jun 17 '22 at 04:33
  • 1
    @AustinAdams It occured to me yesterday to indeed check the QDK extension logs and lo and behold: There was some issues that did not occur when running the previous version of the dotnet-sdk. I have reported the bug in the meantime. – Matthias Jun 17 '22 at 07:09
  • Link to the bug report, for the curious: https://github.com/microsoft/qsharp-compiler/issues/1470. Fingers crossed, this PR will fix it in the next release: https://github.com/microsoft/qsharp-compiler/pull/1467 – Austin Adams Jun 27 '22 at 21:26

1 Answers1

1

Turns out it's a bug with the dotnet-sdk-6.0 version 6.0.301 that breaks the QDK plugin in VSCode. The previous version 6.0.106 does not have this issue.

Matthias
  • 111
  • 2