This is a PowerShell module to enable use of the F# language in PowerShell. It is currently only supported with Powershell 7.2+ at the moment.
There are two separate modules that are published from this repo:
FSharp
: Provides theAdd-FSharpType
command which enables dynamic compilation of F# code to be loaded into PowerShell.FSharp.Core
: Provides the core fsharp libraries for FSharp-based modules. It is binary compatible so you should always set your modules to require the latest version of this module, even if you wrote for an older version, so that the latest version is always used.
Install-Module FSharp
Add-FSharpType -TypeDefinition @'
namespace Test
type Car = {
model: string
name: string
speed: int
}
'@
[Test.Car]::new('Mazda','Miata',65)
model name speed
----- ---- -----
Mazda Miata 65
- Create a new F# powershell module project as normal and set both
FSharp.Core
andSystem.Management.Automation
as privateassets so they are not published. - Your .psd1 file must have a dependency on the
FSharp.Core
module. Set your dependency to the minimumversion of F# code you are using or higher always, do not pin this dependency directly or it will cause problems.