There are 2 ways of running net6.0 .NET Interactive; (1) as a global tool, and (2) as a private tool. Option (1) is the easiest, but alters the global state of the machine. Option (2) is slightly more involved, but doesn't change anything globally.
Both options require a copy of the .NET 6 SDK to be installed.
Run the following command(s) to install the .NET 6 version of the global tool:
# uninstall any old versions
dotnet tool uninstall -g Microsoft.dotnet-interactive
# install the .NET 6 version
dotnet tool install -g Microsoft.dotnet-interactive --version 1.0.250602 --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json
- In VS Code - Insiders, type
Ctrl
+Shift
+P
to open the command palette. - Execute the command "Preferences: Open Settings (JSON)".
- In the
settings.json
that opens, add the following:
// ...
"dotnet-interactive.kernelTransportArgs": [
"dotnet-interactive",
"vscode",
"--working-dir",
"{working_dir}"
],
// ...
- Save
settings.json
and restart VS Code - Insiders. - Any notebooks opened will now be running against the .NET 6 kernel. To revert back to the defualt behavior, simply comment out/delete the lines from step 3 and restart VS Code - Insiders.
- This part only needs to happen once.
- Run the following in any .NET Interactive notebook. It will fail but it dowloaded the .NET 6 version of the tool to the local package cache.
#i "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json"
#r "nuget:Microsoft.dotnet-interactive, 1.0.250602"
- In VS Code - Insiders, type
Ctrl
+Shift
+P
to open the command palette. - Execute the command "Preferences: Open Settings (JSON)".
- In the
settings.json
that opens, add the following:
// ...
"dotnet-interactive.kernelTransportArgs": [
"{dotnet_path}",
"C:/Users/brett/.nuget/packages/microsoft.dotnet-interactive/1.0.250602/tools/net6.0/any/Microsoft.DotNet.Interactive.App.dll",
// ^^^^^ this should be updated to match your current user name
"vscode",
"--working-dir",
"{working_dir}"
],
// ...
- Save
settings.json
and restart VS Code - Insiders. - Any notebooks opened will now be running against the .NET 6 kernel. To revert back to the defualt behavior, simply comment out/delete the lines from step 3 and restart VS Code - Insiders.
#r "C:\Users\brett\source\repos\MyDotNet6Library\MyDotNet6Library\obj\Debug\net6.0\MyDotNet6Library.dll"
MyDotNet6Library.MyLibrary.AddTwoNumbers(2, 3)