The precious .NET 5 has finally arrived in our workspace, and I’m thrilled. .NET 5 is a unified and cross-platform supported runtime for C# and F# developers. Also, it has balanced cross-platform features across all environments, including existing your old familiar Windows desktop environment and Linux, Cloud-native, macOS, even machine learning, Apache Spark, and Web Assembly.
I’m recently taking a series of the episode called the Azure Playlists project in cooperation with Microsoft Korea. I thought a lot about how to present my PowerShell code to viewers effectively. After many trials and errors, I got a neat but simple idea.
With the release of .NET 5, Microsoft also launches many useful tools as open-source projects. .NET Interactive is one-of-them, and I found it.
.NET Interactive provides three types of .NET kernels, C#, F#, and PowerShell. I used PowerShell to introduce Azure related tools. Because PowerShell works almost the same across all three OSes (including Windows, Linux, and macOS). With .NET Interactive, I can reuse my existing knowledge to Jupyter notebook without any hassle.
As you already know, the Jupyter notebook can contain the runnable code and its results to understand its meaning and how it works. This time, you can replace your code with C#, F#, or PowerShell.
You can bring your notebook anywhere and any operating system because the Anaconda and .NET 5 supports all major operating systems. If you already installed these two components, you can follow the commands below.
dotnet tool install \
--add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" \
dotnet interactive jupyter install
After you installed the .NET Interactive successfully, you can verify your installation with the command below.
jupyter kernelspec list.net-csharp ~\jupyter\kernels\.net-csharp
Then, create a new notebook with your shiny-new .NET interactive kernel. For example, I made a notebook with the PowerShell kernel.
Verify your code and save the notebook. Then, you already know how to display each cell as a presentation slide, right? Let’s see it.
(For starters, you can follow the link that describes how to convert each notebook’s cell into a slide.)
Voila! You can deliver your notebook anywhere.
Recently, I’m writing a tutorial for C# starters with Jupyter notebook and mkdocs. The mkdocs can include the Jupyter notebook file as a page and provide a download link. Anyone can install the Anaconda, .NET 5, and .NET interactive; many starters can easily use the notebook file to learn .NET languages effectively.
Take the time to look around it!