There is no function that would allow you to do this directly. However, when you want to compile an F# source file programatically, you can invoke the F# compiler from your application. The easiest way to do this is to use F# CodeDOM provider, which is available as part of the F# PowerPack (in the FSharp.Compiler.CodeDom.dll
assembly). However, note that you need to have the F# compiler installed on the user's machine.
The code to run the compiler would look roughly like this:
open Microsoft.FSharp.Compiler.CodeDom
let provider = new FSharpCodeProvider()
let compiler = provider.CreateCompiler()
let parameters = new CompilerParameters
(GenerateExecutable = true, OutputAssembly = "file.exe")
let results = icc.CompileAssemblyFromFile(parameters, "filename.fs")
Once you compile the source file into an assembly, you'll need to load the assembly using .NET Reflection and run some specific function or class from the assembly (you can for example look for a function with some special name or marked with some attribute).
(As a side-note, using quotations or writing your own interpreter as mentioned in the related SO question may be an option if your source code is relatively simple, but probably not if you want to support the full power of F#)