dotnet run -f net8.0
Hello from F#
IFDEF: This is .NET 8.0
Assembly: .NETCoreApp,Version=v8.0
System DLL: 8.0.0.0
After setting RollForward
Hello from F#
IFDEF: This is .NET 8.0
Assembly: .NETCoreApp,Version=v8.0
System DLL: 10.0.0.0
dotnet run -f net8.0
Hello from F#
IFDEF: This is .NET 8.0
Assembly: .NETCoreApp,Version=v8.0
System DLL: 8.0.0.0
After setting RollForward
Hello from F#
IFDEF: This is .NET 8.0
Assembly: .NETCoreApp,Version=v8.0
System DLL: 10.0.0.0
| <Project Sdk="Microsoft.NET.Sdk"> | |
| <PropertyGroup> | |
| <OutputType>Exe</OutputType> | |
| <TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks> | |
| <RootNamespace>different_tfms</RootNamespace> | |
| </PropertyGroup> | |
| <ItemGroup> | |
| <Compile Include="Program.fs" /> | |
| </ItemGroup> | |
| </Project> |
| let ifDefRuntime = | |
| #if NET8_0 | |
| "This is .NET 8.0" | |
| #endif | |
| #if NET9_0 | |
| "This is .NET 9.0" | |
| #endif | |
| #if NET10_0 | |
| "This is .NET 10.0" | |
| #endif | |
| let assemblyRuntime = | |
| System.Reflection.Assembly | |
| .GetExecutingAssembly() | |
| .GetCustomAttributes(typeof<System.Runtime.Versioning.TargetFrameworkAttribute>, false) | |
| |> Seq.cast<System.Runtime.Versioning.TargetFrameworkAttribute> | |
| |> Seq.head | |
| |> fun attr -> attr.FrameworkName | |
| let systemDllVersion = | |
| typeof<System.String> | |
| .Assembly | |
| .GetName() | |
| .Version | |
| |> string | |
| // For more information see https://aka.ms/fsharp-console-apps | |
| printfn $"Hello from F#" | |
| printfn $"IFDEF: {ifDefRuntime}" | |
| printfn $"Assembly: {assemblyRuntime}" | |
| printfn $"System DLL: {systemDllVersion}" |