Reputation: 1045
I have a single F# file which I build so far via
fsc --standalone Foo.fs
into a single executable file which I can distribute to others who have not installed the F# toolchain.
Now I thought I move to a .fsproj file which scales better the more files I add to my project. Consider the following .fsproj file:
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
<PackageReference Include="FSharp.Core" Version="4.5.*" />
<Compile Include="Foo.fsx" />
</ItemGroup>
</Project>
If I run dotnet build
in a directory which contains both files, then I get the following output:
C:\Users\BillGates\.nuget\packages\fsharp.net.sdk\1.0.5\build\FSharp.NET.Core.Sdk.targets(170,9): error MSB6006: "dotnet.exe" exited with code -2147450730. [C:\temp\Foo.fsproj]
Searching for the error code -2147450730
did not help me. Any idea what is wrong with my setup? Any hints how to build a stand alone executable file from a F# file?
I'm using the following .NET versions:
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.401\
Host (useful for support):
Version: 2.1.3
Commit: 124038c13e
.NET Core SDKs installed:
2.1.401 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Upvotes: 5
Views: 3040
Reputation: 1704
DO not use FSharp.NET.Sdk
with any recent tooling. It was an intermediate package as long as F# was not in the box. Nowadays F# is in the box and the following should give you a working version:
dotnet new -lang f#
dotnet build
Upvotes: 3