dotnet / dotnet/fsharp

Add support for referencing .NET projects in F# interactive

Open
#8,764 35 comments 80 reactions 0 assignees View on GitHub
Area-FSI Feature Request Theme-Simple-F#
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

**Is your feature request related to a problem? Please describe.**

It would be nice to have similar functionality like in other languages, where it is possible to reference a project inside an interactive session.
Languages that support such functionality are for example: Haskell, Elixir, Python, Clojure

**Describe the solution you'd like**

I would like to start an interactive session and reference the project like I would reference an assembly file today.

An example could be (F# projects only):

#r "fsproj: MyProject.fsproj"

or (across languages):

#r "project: MyProject.fsproj"
#r "project: MyProject.csproj

> Those two proposals need to be tackled very differently. For a F# only solution it is enough to reference all library references and the F# source files. In order to work across .NET languages it is needed to compile the project first and then reference the libraries and the generated assembly.

@Krzysztof-Cieslak has already created a prototype where he got working a F# only solution: https://github.com/Krzysztof-Cieslak/DependencyManager.FsProj

So the first question to answer is:
* [ ] Should the solution work for fsproj and csproj files from the beginning?
* [ ] Should we define a cross project syntax and start with an F# only solution?
* [ ] Is it a F# fsproj only thing?

**Describe alternatives you've considered**

* Reference every library reference and every project source file by hand.
* Use `#r: "nuget: Dependency"` for every dependent library and add every source file by hand
* Use paket (`generate_load_scripts`) to generate library references in a script file that can be used in your script and then reference every source file by hand

**Additional context**

I've created this issue because there was an ongoing discussion started here: https://github.com/fsharp/fslang-suggestions/issues/542

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.