Found that the question was pondered a few years ago: https://github.com/dotnet/fsharp/issues/8688
My code looks like
#r "nuget: Microsoft.NETCore.App"
#r "nuget: Microsoft.NETCore.App.Ref"
#r "nuget: Microsoft.AspNetCore"
open Microsoft.AspNetCore.Builder
let builder = WebApplication.CreateBuilder(args)
But that does not work.
No you can't do that, directly referencing ASP.NET Core within an F# fsx script isn't officially supported, but you can try that manually as a workarounds.
You would require to load assembly reference
dllfile then need to open it.Let's say, you want to refer following dll file from your directory:
Use #r "path/to/assembly.dll" to reference assemblies manually.
Then you have to locate required ASP.NET Core assemblies in your .NET Core installation
For insctance: If I want to refer
Microsoft.AspNetCore.dllfrom the above directory, then you can do as following:Note: I would highly recommend you to refer this official document