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?