If you would like to build dotnet-interactive
tool and its associated libraries, follow these steps.
This repo depends on symbolic links between directories. By default Windows doesn't support this feature. To work around this scenario, please run the PowerShell script <root>/src/ensure-symlinks.ps1
as an administrator. This usually only needs to be run once.
This project depends on .NET 5.0. Before working on the project, check that the .NET prerequisites have been met:
This project supports Visual Studio 2019 and Visual Studio for Mac. Any version, including the free Community Edition, should be sufficient, as long as you install Visual Studio support for .NET development.
This project also supports using Visual Studio Code. Install the C# extension and install the .NET SDK to get started.
You can also build this project on the command line by running the following scripts in the root of the repo:
Windows:
> .\build.cmd -test
Linux or macOS:
$ ./build.sh --test
You can both build and run the tests for the project by running the scripts with the following option:
Windows:
> .\build.cmd -test
Linux or macOS:
$ ./build.sh --test
For additional options, you can get help as follows:
Windows:
> .\build.cmd -help
Linux or macOS:
$ ./build.sh --help
To build and then install your developer build of the dotnet-interactive
global tool, you can run the PowerShell script
pwsh src/dotnet-interactive/build-and-install-dotnet-interactive.ps1
Powershell for .NET Core is required. This will uninstall any previous version of dotnet-interactive
you might have installed.
.NET Interactive is built with the support of the Arcade build system. The Arcade tools provide common infrastructure for building, testing, and publishing .NET Foundation projects. This build system is not required for local development work, but using it will provide a higher-fidelity
If you prefer a development environment that's more consistent with the out-of-the-box .NET experience, you can set the environment variable DisableArcade
to 1
.
In order to build the .NET Interactive Notebooks Visual Studio Code extension, please follow the instructions below. Note that it's not necessary to use a local build of dotnet-interactive
in order to work on the Visual Studio Code extension.
To get started, you'll need:
-
The LTS version of nodejs.
-
Run
npm i
in the<REPO-ROOT>/src/dotnet-interactive-vscode/
directory. -
Open the
<REPO-ROOT>/src/dotnet-interactive-vscode/
directory in Visual Studio Code Insiders. (From your terminal, you can runcode-insiders <REPO-ROOT>/src/dotnet-interactive-vscode/
.) -
Make appropriate changes to the
<REPO-ROOT>/src/
directory. -
Press F5 to launch the Visual Studio Code Extension Development Host.
-
Run
.NET Interactive: Create new blank notebook
or open a file with the.ipynb
extension.
If you've made changes to dotnet-interactive
and want to try them out with Visual Studio Code, follow these steps:
-
Make appropriate changes and build the
<REPO-ROOT>/src/dotnet-interactive/dotnet-interactive.csproj
project. -
In an instance of Visual Studio Code Insiders that has the extension installed (either via the marketplace or through the steps above), change the launch settings for the
dotnet-interactive
tool:-
Open the settings via
File
->Preferences
->Settings
, or by pressingCtrl + ,
. -
Filter the list by typing
dotnet-interactive
-
Find the setting labelled:
Dotnet-interactive: Kernel transport args
. -
Click
Edit in settings.json
. -
In the file that opens, make the following changes, updating the path where appropriate:
"dotnet-interactive.kernelTransportArgs": [ "{dotnet_path}", - "tool", - "run", - "dotnet-interactive", - "--", + "/PATH/TO/REPO/ROOT/artifacts/bin/dotnet-interactive/Debug/net5.0/Microsoft.DotNet.Interactive.App.dll", "[vscode]", "vscode", + "--log-path", + "/path/to/a/folder/for/your/logs/", + "--verbose", "--working-dir", "{working_dir}" ]
-
-
Save
settings.json
. -
Any subsequently opened notebooks will use your local changes.
-
To revert back to the original settings, follow steps 1-3 then next to the text
Dotnet-interactive: Kernel transport args
, click the gear icon thenReset Setting
.
If you've made changes to one of the dotnet-interactive
extensions and want to use them locally follow these steps:
-
Run
build.[cmd/sh] --pack
to create the Nuget packages for the extensions -
Ensure that there aren't any kernels running for the extension in question. It's generally best to close all Notebooks opened in VS Code to accomplish this.
-
Run the
.NET Interactive: Create a new blank notebook
command in VS Code. Select.dib
or.ipynb
as the extension and any language as default. -
Save the Notebook anywhere you like
-
Run the
.NET Interactive: Restart the current Notebook's kernel
command -
In the first code cell paste this code
- In the FolderName give the path to the nuget cache, this should be
%userprofile%\.nuget\packages
on Windows and~/.nuget/packages
on Mac/Linux - Also replace
EXTENSIONNAME
with the name of the extension (e.g.microsoft.dotnet.interactive.sqlserver
) - On the #i line fill in the path to the
dotnet-interactive
repo root - On the #r line use the same
EXTENSIONNAME
above, and then look in theartifacts\packages\Debug\Shipping
folder for the package you're using and get the version number from the name. e.g. a package namedMicrosoft.DotNet.Interactive.SqlServer.1.0.0-dev.nupkg
would result in this line#r "nuget: Microsoft.DotNet.Interactive.SqlServer, 1.0.0-dev"
- In the FolderName give the path to the nuget cache, this should be
#!powershell
$FolderName = "\PATH\TO\NUGET\CACHE\packages\microsoft.dotnet.interactive.<EXTENSIONNAME>"
if (Test-Path $FolderName) {
Remove-Item $FolderName -Recurse -Force
}
else
{
Write-Host "Folder Doesn't Exist"
}
#!csharp
#i "nuget: \PATH\TO\REPO\ROOT\artifacts\packages\Debug\Shipping"
#r "nuget: Microsoft.DotNet.Interactive.<EXTENSIONNAME>, <EXTENSIONVERSION>"
- Run the cell
- If you get an error about access being denied ensure that all other Notebooks are closed and then restart the kernel again as in step 5
- Now use the kernel as you normally would. You should see your local changes being used by the extension.