4

Add support for referencing .NET projects in F# interactive · Issue #8764 · dotn...

 2 years ago
source link: https://github.com/dotnet/fsharp/issues/8764
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

toburger commented on Mar 21, 2020

edited

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: fsharp/fslang-suggestions#542


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK