Scott Hanselman

Announcing .NET Interactive - Try .NET includes .NET Notebooks and more

February 12, 2020 Comment on this post [13] Posted in DotNetCore | Open Source
Sponsored By

At Microsoft Ignite 2019, we were happy to announce that the "Try .NET global tool" added support for C# and F# Jupyter notebooks. Last week, the same team that brought you .NET Notebooks announced Preview 2 of the .NET Notebook.

Name Change - .NET interactive

As the scenarios for what was "Try .NET" continued to grow, the team wanted to a name that encompassed all the experiences they have as well as all the experiences they will have in the future. What was the Try .NET family of projects is now .NET interactive.

The F# community has enjoyed F# in Juypter Notebooks from years with the pioneering functional work of Rick Minerich, Colin Gravill and many other contributors! .NET Interactive is a family of tools and kernels that offer support across a variety of experiences as a 1st party Microsoft-supported offering.

.NET interactive is a group of CLI (command line interface) tools and APIs that enable users to create interactive experiences across the web, markdown, and notebooks.

.NET Interactive APIs and Tools

Here is what the command line looks like using the dotnet CLI.

  • dotnet interactive global tool:
  • dotnet try global tool:
    • Used for workshops and offline documentation. Interactive markdown with a backing project. I wrote about this in May 2019.
  • trydotnet.js API
    • Currently, only used internally at Microsoft, this API is used on the .NET page and C# documentation. Maybe one day I can use it on my blog? And yours?

Installing .NET Interactive

You can start playing with it today, locally or in the cloud! Seriously. Just click and start using it.

Before you install the .NET interactive global tool, please make sure you have the following:

> jupyter kernelspec list
  python3        ~\jupyter\kernels\python3
  • Open Windows terminal and install the dotnet interactive global tool:
> dotnet tool install --global Microsoft.dotnet-interactive
  • Switch back to Anaconda prompt and install the .NET kernel. To be clear, here we are using the dotnet CLI to let the Jupyter CLI know that we exist!
> dotnet interactive jupyter install
[InstallKernelSpec] Installed kernelspec .net-csharp in ~\jupyter\kernels\.net-csharp
.NET kernel installation succeeded

[InstallKernelSpec] Installed kernelspec .net-fsharp in ~\jupyter\kernels\.net-fsharp
.NET kernel installation succeeded

[InstallKernelSpec] Installed kernelspec .net-powershell in ~\jupyter\kernels\.net-powershell
.NET kernel installation succeeded
  • While still in Anaconda prompt, verify that .NET kernel is installed like this
> jupyter kernelspec list
  .net-csharp     ~\jupyter\kernels\.net-csharp
  .net-fsharp     ~\jupyter\kernels\.net-fsharp
  .net-powershell ~\jupyter\kernels\.net-powershell
  python3         ~\jupyter\kernels\python3

Now you can just run "jupyter lab" at the command line and you're ready to go!

More Languages - PowerShell

The .NET kernel now comes PowerShell support too! In Preview 2, the .NET interactive team partnered with PowerShell to enable this scenario. You can read more about the announcement of the PowerShell blog.

.NET in Jupyter Notebooks

The .NET interactive team is looking forward to hearing your thoughts. You can talk to them at

Multi .NET language Notebooks

I wanted to highlight one of the hidden gems .NET interactive has had since Preview 1 - multi-language notebooks. That means that users can switch languages in a single notebook. Here is an example of a C#, F#, and PowerShell in a single .ipynb file.

Multiple Language Notebooks

Using one of the language magic commands (#!csharp, #!fsharp,#pwsh) tells the .NET Interactive kernel to run the cell in a specific language. To see a complete list of the available magic commands, enter the #!lsmagic command into a new cell and run it.

.NET Code in

Additionally, you can now write .NET Code in Nteract is an open-source organization that builds SDKs, applications, and libraries that helps people make the most of interactive notebooks and REPLs. We are excited to have our .NET users take advantage of the rich REPL experience nteract provides, including the nteract desktop app.

Charts and graphs in nteract

To get started with .NET Interactive in nteract please download the nteract desktop app and install the .NET kernels.

Learn More

The team is looking forward to seeing what you build. Moving forward, the team has split dotnet try and dotnet interactive tools into separate repos.

  • For any issues, feature requests, and contributions to .NET Notebooks, please visit the .NET Interactive repo.
  • For any issues, feature requests, and contributions on interactive markdown and trydotnet.js, please visit the Try .NET repo.

Sponsor: Have you tried developing in Rider yet? This fast and feature-rich cross-platform IDE improves your code for .NET, ASP.NET, .NET Core, Xamarin, and Unity applications on Windows, Mac, and Linux.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
February 16, 2020 6:36
Can we also not forget the pioneering work done by Xamarin with Xamarin Workbooks?
February 16, 2020 8:27
Hello! Thank you for your post. I think it wood be nice to have some hosting for .Net Jupyter notebooks. In this case we can use such hosting instead of Also new developers can use such online platform for educational projects.
February 16, 2020 22:21
I had gotten started recently on Jupyter and it was my first time installing Python on my Mac and things got squirrelly when I tried installing pip (I think that's where things went wrong), so at some point I ended up involving Homebrew either to get pip installed or Jupyter installed, but since that time, I have been able to run the jupyter command but I have been nervous that I did not install this the proper way. I'm very excited to get moving with this article, as I've been a little confused on getting started after running "jupyter notebook" in terminal.

However, before I move any further, I was wondering if you could tell me if I should try to redo my python-pip-jupyter setup. Here's what I currently get when I run "jupyter kernelspec list":

Available kernels:
python3 /usr/local/Cellar/jupyterlab/1.2.4/libexec/lib/python3.7/site-packages/ipykernel/resources

Think I'm safe to proceed or should I try and untangle my mess first?
February 17, 2020 10:40
I wasn't aware that I can switch languages in one notebook. Great insights, thanks Scott!
February 19, 2020 1:40
From Maria Naggaga on the linked thread:

"In the blog post I didn’t specify the package version just to make sure that the post stays fresh. Please use this command as seen on nuget:"

dotnet tool install --global Microsoft.dotnet-interactive --version 1.0.110520
February 19, 2020 9:19
I tried to apply this on Visual Studio Online Environment. You had recently blogged about this and I as well because I really liked it's potential though expensive. But I couldn't get JUpyter notebooks to run properly. Everything was setup like you mentioned with some minor adjustments and Jupyter starts correctly but within the Jupyter notebook there were 2 problems:

First is that the icons for Python, .NET and PowerShell were not visible. The launcher looked broken but I thought that this could be a problem of a different port and hostname. For example the notebook having urls to localhost which won't resolve.

Second is that the kernels wouldn't start. I even tried this without the .net and powershell kernels configured. Just Python and Jupyter.

These are my individual commands

sudo apt-get update
sudo apt-get -y install aspnetcore-runtime-3.1
sudo pip install --upgrade pip
sudo pip install jupyterlab
sudo pip install notebook
sudo dotnet tool install --global Microsoft.dotnet-interactive
export PATH="$PATH:/home/vsonline/.dotnet/tools"
export DOTNET_ROOT="$(dirname $(which dotnet))"

Excluding the dotnet relevant lines installs and configures the notebooks for Python.
February 19, 2020 18:12
@Alex Sarafian, I think they might appreciate this feedback here
February 24, 2020 10:13

This is one of the best article i am reading right now. great work and really informative and helpful me to
February 26, 2020 7:29
Hi Scott,

I would love to know what you think about the Nethereum playground. Similar idea but targeted to a specific set of libraries and Blazor / Wasm
February 26, 2020 9:33
This is one of the best article i am reading right now. great work and really informative and helpful me to
February 26, 2020 16:36
Hi Scott, This is fantastic! I would love to know how to install and use components from nuget.
October 24, 2020 16:30
What's Going down i'm a novice to this, I found this I've found It absolutely helpful and contains helped me
out loads. I am just hoping to contribute & aid different users like its aided me.
Great job.
November 04, 2020 20:46
Hmm it seems like your blog ate my first comment (it absolutely was super long) therefore i guess I'll just sum it a few things i wrote and say, I'm thoroughly enjoying your blog site.
I too am an aspiring blog blogger but I'm still unfamiliar with the whole thing.
Do you have any suggestions for first-time blog writers?
I'd certainly appreciate it.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.