%project

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

The Modern QDK only supports the '%%qsharp' magic command.

Summary

Provides the ability to view or add Q# project references.

Description

This magic command allows for adding references to Q# projects to be compiled and loaded into the current IQ# session.

The command accepts a single argument, which is the path to a .csproj file to be loaded. The .csproj file must reference the Microsoft.Quantum.Sdk. The provided path may be either an absolute path or a path relative to the current workspace root folder (usually the folder containing the current .ipynb file). The project file will be added to the session and then the workspace will be reloaded, which will automatically load any downstream packages or projects referenced by the specified .csproj file and will recompile all associated .qs source files.

If no argument is provided, the command simply returns the list of projects loaded in the current IQ# session.

Examples for %project

Example 1

Add a reference to the C:\Projects\MyProject.csproj Q# project into the current IQ# session:

In []: %project C:\Projects\MyProject.csproj
Out[]: Loading project C:\Projects\MyProject.csproj and dependencies...
       <list of all loaded Q# project references>

Example 2

View the list of all Q# project references that have been loaded into the current IQ# session:

In []: %project
Out[]: <list of all loaded Q# project references>