Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在VS代码中构建Q#程序_C#_Visual Studio Code_Q# - Fatal编程技术网

C# 无法在VS代码中构建Q#程序

C# 无法在VS代码中构建Q#程序,c#,visual-studio-code,q#,C#,Visual Studio Code,Q#,我是量子计算新手,刚刚安装了微软的VisualStudio代码和QDK扩展。但是,当我尝试构建和运行(从终端运行dotnet)时,它无法为我提供输出,并且尽管安装了扩展(quantum sdk),但仍会抛出一些关于名称空间的错误。我很可能在做傻事,所以请给我指出正确的方向 我的计划是: namespace helloqworld { open Microsoft.Quantum.Canon; open Microsoft.Quantum.Intrinsic; @En

我是量子计算新手,刚刚安装了微软的VisualStudio代码和QDK扩展。但是,当我尝试构建和运行(从终端运行dotnet)时,它无法为我提供输出,并且尽管安装了扩展(quantum sdk),但仍会抛出一些关于名称空间的错误。我很可能在做傻事,所以请给我指出正确的方向

我的计划是:

namespace helloqworld {

    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Intrinsic;


    @EntryPoint()
    operation HelloQ() : Unit {
        Message("Hello quantum world!");
    }
}
我得到以下错误:

No namespace with the name "Microsoft.Quantum.Canon" exists.
No namespace with the name "Microsoft.Quantum.Intrinsic" exists.
{
    "resource": "/Users/nalini/Desktop/helloqworld/Program.qs",
    "owner": "_generated_diagnostic_collection_name_#0",
    "code": "QS6005",
    "severity": 8,
    "message": "No type with the name \"EntryPoint\" exists in any of the open namespaces.",
    "source": "/Users/nalini/Desktop/helloqworld/Program.qs",
    "startLineNumber": 9,
    "startColumn": 6,
    "endLineNumber": 9,
    "endColumn": 16
}
{
    "resource": "/Users/nalini/Desktop/helloqworld/Program.qs",
    "owner": "_generated_diagnostic_collection_name_#0",
    "code": "QS5022",
    "severity": 8,
    "message": "No identifier with the name \"Message\" exists.",
    "source": "/Users/nalini/Desktop/helloqworld/Program.qs",
    "startLineNumber": 11,
    "startColumn": 9,
    "endLineNumber": 11,
    "endColumn": 16
}
我的csproj文件有:

Project Sdk="Microsoft.Quantum.Sdk/0.11.2004.2825">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

</Project>
projectsdk=“Microsoft.Quantum.Sdk/0.11.2004.2825”>
Exe
netcoreapp3.1

如果您只是从终端运行
dotnet,您的代码构建和运行是否成功?如果是这种情况,则此错误来自IntelliSense

您正在使用.NET Core 3.1.300吗?我认为QDK发行版0.11.2004.2825在.NET Core 3.1.300中存在IntelliSense问题,特别是(the),将.NET Core降级为3.1.201可以修复此问题