-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.fs
More file actions
35 lines (28 loc) · 1.03 KB
/
Program.fs
File metadata and controls
35 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace Example
open System
open System.IO
open System.Reflection
open WoofWare.DotnetRuntimeLocator
module Program =
[<EntryPoint>]
let main argv =
let info = DotnetEnvironmentInfo.Get ()
Console.WriteLine info
Console.WriteLine "SDKs:"
for sdk in info.Sdks do
Console.WriteLine $"SDK: %O{sdk}"
Console.WriteLine "Frameworks:"
for f in info.Frameworks do
Console.WriteLine $"Framework: %O{f}"
// Identify the runtime which would execute this DLL
let self = Assembly.GetExecutingAssembly().Location
let runtimeSearchDirs = DotnetRuntime.SelectForDll self
// For example, the System.Text.Json.dll which this DLL would load:
runtimeSearchDirs
|> Seq.tryPick (fun dir ->
let attempt = Path.Combine (dir, "System.Text.Json.dll")
if File.Exists attempt then Some attempt else None
)
|> Option.get
|> fun s -> Console.WriteLine $"System.Text.Json location: %s{s}"
0