So I'm starting to learn F# from the tryfsharp.org and I'm using VS2013. What are the differences of the .fs
(source), .fsx
(script) and .fsi
(signature)?
Script written in F# (pronounced "F Sharp"), a functional programming language formally introduced by Microsoft with Visual Studio 2010; can be run with the "F# Interactive" component of Visual Studio; used for scripting F# code instead of compiling it.
To execute code interactively, simply type code in an . fsx file, select a block of code, and hit Alt + Enter . The selected code will be evaluated, and the result will show up in the FSI window. In Visual Studio, you can also select code and right-click “Execute in Interactive”, but shortcuts are way faster.
You can start by creating a new "F# Script" (File -> New -> File...) and then start writing some code (in an assorted order). Then you can select some part of the code and evaluate it in the F# Interactive window by perssing [Alt]+[Enter].
.fsx
is for individual files intended to run as a script. In particular, in an .fsx
file you can use things like #r "Foo.dll"
to dynamically load a library and #load "Foo.fsx"
to load another script file.
[Edit: and starting with .NET 5, #r "nuget: FooBar"
to load a NuGet package.]
.fs
is for source files compiled as part of a project.
.fsi
is for signature files, they are optional and describe the API of a corresponding .fs
file. More detail here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With