Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Reference to unknown namespace Microsoft.Quantum.Intrinsic #212

Closed
stefante opened this issue Jul 19, 2019 · 4 comments
Closed

Reference to unknown namespace Microsoft.Quantum.Intrinsic #212

stefante opened this issue Jul 19, 2019 · 4 comments
Labels
Resolution-Question Issue closed because the issue was a question that has been answered.

Comments

@stefante
Copy link

Describe the bug
I am following the instructions for the "hello world"program

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

operation HelloQ () : Unit {
    Message("Hello quantum world!");
}

}

on "dotnet run" I always get the same error message

"Reference to unknown namespace Microsoft.Quantum.Intrinsic"

How do I properly reference this namespace? Thanks

@anpaz
Copy link
Member

anpaz commented Jul 19, 2019

Hi @stefante, can you add more details about the error message? There is typically a code and a line number associated with the error that will give us more information.
Also, can you let us know what version of .net core (dotnet --info) and what OS this is running on?

@cgranade cgranade added the Status-NeedMoreInfo Issue blocked because more information is needed in order to proceed. label Jul 25, 2019
@stefante
Copy link
Author

stefante commented Jul 30, 2019

Hi @anpaz-msft,

Thanks for the reply and your help

I am running dotnet 2.2.301 and Mac OS Mojave 10.14.5

The first messages are:

  • Bell.qs(1,23): error QS0001: The namespace body is invalid [/Users....../Bell/Bell.csproj]

  • Bell.qs(3,5): error QS0001: Reference to unknown namespace Microsoft.Quantum.Intrinsic [/Users..... /Bell/Bell.csproj]

Bell.csproj was autogenerated and includes the 2 following package references

  • PackageReference Include="Microsoft.Quantum.Canon" Version="0.2.1806.3001-preview"
  • PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.2.1806.3001-preview" /

@cgranade
Copy link
Contributor

@stefante: It sounds like your project templates are out-of-date, as we're currently on version 0.8.1907.1701. In particular, the namespace name Microsoft.Quantum.Intrinsic was introduced with Q# version 0.6, such that this error makes sense when using a package reference to version 0.2 of the Quantum Development Kit.

To update, I'd suggest two steps:

Update your project templates to version 0.8

dotnet new -i Microsoft.Quantum.ProjectTemplates::0.8.1907.1701

Migrate your existing Bell.csproj to use 0.8

To migrate existing projects to use 0.8, use the migration notes for 0.6, but with the version number 0.8.1907.1701 instead. In this case, your Bell.csproj file should include the following lines:

<ItemGroup>
    <PackageReference Include="Microsoft.Quantum.Development.Kit" Version="0.8.1907.1701" />
    <PackageReference Include="Microsoft.Quantum.Standard" Version="0.8.1907.1701" />
</ItemGroup>

@cgranade cgranade removed the Status-NeedMoreInfo Issue blocked because more information is needed in order to proceed. label Jul 30, 2019
@cgranade
Copy link
Contributor

Closing the issue, as I believe that the problem was the version mismatch. If you have any additional questions or if there is a bug with the update process, please feel free to reopen the issue or to file a new issue. Thanks for your feedback!

@cgranade cgranade added Resolution-Question Issue closed because the issue was a question that has been answered. and removed Kind-Bug labels Jul 30, 2019
jwittner pushed a commit to jwittner/Quantum that referenced this issue Dec 16, 2019
…ributes on types and callables defined in referenced dlls (microsoft#212)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution-Question Issue closed because the issue was a question that has been answered.
Projects
None yet
Development

No branches or pull requests

3 participants