dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.88k stars 382 forks source link

Extension Packaging and Documentation #1831

Open ktodyruik opened 2 years ago

ktodyruik commented 2 years ago

I've been going through the documentation on extending dotnet interactive, and creating a custom extension. Creating my own HelloWorld kernel extension.

I read through this:

https://github.com/dotnet/interactive/blob/main/docs/extending-dotnet-interactive.md

Also followed the ClockExtension example, and read through ClockExtension.ipynb . I believe I had followed all the documentation correctly. Seems extension assembly/class discovery is straightforward. Except then my package would load but my extension class wasn't detected.

Manually adding this to my extension's .csproj file (which I found reading the .csproj file for ClockExtension...) fixed the discovery problem:

  <ItemGroup>
    <None Include="$(OutputPath)/MyKernelExtension.dll" Pack="true" PackagePath="interactive-extensions/dotnet" />
  </ItemGroup>

I don't see this in the documentation anywhere, and it's not clear why this was needed. Why the extension loader couldn't find my kernel extension assembly/class in the nuget package I originally generated.

Thanks.

jonsequitur commented 2 years ago

Placing this file in the package is not a default NuGet behavior. Until this is done, .NET Interactive has no way to know there's an extension, and since most packages don't contain extensions, we don't want to scan every assembly we load for them.