0
$\begingroup$

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("Hello quantum world!");
    }
}

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?

$\endgroup$
4
  • 4
    $\begingroup$ I’m voting to close this question because it is not about quantum computing but a software instalation issue. $\endgroup$ Commented Jun 16, 2022 at 17:23
  • $\begingroup$ 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: github.com/microsoft/qsharp-compiler/issues) $\endgroup$ Commented Jun 17, 2022 at 4:33
  • 1
    $\begingroup$ @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. $\endgroup$
    – Matthias
    Commented Jun 17, 2022 at 7:09
  • $\begingroup$ Link to the bug report, for the curious: github.com/microsoft/qsharp-compiler/issues/1470. Fingers crossed, this PR will fix it in the next release: github.com/microsoft/qsharp-compiler/pull/1467 $\endgroup$ Commented Jun 27, 2022 at 21:26

1 Answer 1

1
$\begingroup$

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.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.