3

Using NET 6 I have the following project structure:

nuget.config
project.code-workspace
- Core
  Core.csproj
- Api
  Api.csproj
- Sim
  notebook.ipynb

Where notebook.ipynb is for now just:

#i "nuget:https://api.nuget.org/v3/index.json"

#r "nuget:Microsoft.Data.Analysis,0.*"

using System;
using Microsoft.Data.Analysis;

Console.WriteLine("Hello World!");

How to include a project reference to Core and Api projects in notebook.ipynb?

I need to use some of the Core and Api project classes in notebook.ipynb.

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481

1 Answers1

6

Currently that is not supported out of the box. See this issue. I've tried to use dotnet pack and install created package from local folder but failed. The only I've managed to make work is to build solution and add .dll manually:

Assuming next solution structure:

connect_solution.ipynb
- ClassLib\ClassLib.csproj (contains SomeDep.cs)
- Api\Api.csproj (references ClassLib.csproj, contains WeatherForecast)
#!pwsh 
dotnet build .\Api\Api.csproj --verbosity quiet
#r ".\Api\bin\Debug\net6.0\Api.dll"
using ClassLib;
using Api;
new SomeDep().Display();
new WeatherForecast()
Guru Stron
  • 102,774
  • 10
  • 95
  • 132