Using the interactive shell fsi

I am still struggling to understand the dotnet ecosystem

The IDE culture of Microsoft, really seem to be incompatible with how I think

Is there a way to install a package for example Newtonsoft.Json or any package, so that I can do
dotnet fsiand open the package in the fsi interactive shell ?

Install-Package doesnt seem to work, for this use case
Install-Package from pwsh 7 doesnt even seem to be able to even install Newtonsoft.Json

for example Install-Package Newtonsoft.Json -Version 12.0.3 wont work on pwsh 7, the command available for pwsh7 is different and doesnt have the version option

Install-Package Newtonsoft.Json -MininumVersion 12.0.3 also doesnt work, because although there is no dependencies, it does try to install dependencies and fail

It seems that dotnet only believes i creating a project and publishing it
using fsi for exploration seem very limited

1 Like

The .NET project system is currently completely unconnected to F# scripts or FSI.

The ability to reference NuGet packages in FSI/FSX has already been implemented and will be in the next F# release. See here for more info.

The ability to bring in a project’s dependencies is not built-in either, but it has been suggested here. There is a way to do it currently if you use Paket as your dependency manager (an improvement on NuGet that still uses the online NuGet package repository). It has a generate-load-scripts feature which lets you do this.

1 Like

By the way, I highly recommend against using FSI in a terminal. Write your code into a script file in your editor instead and send code to FSI with Alt-Enter. There are many advantages to working this way.

1 Like