I was trying to follow https://github.com/enricosada/fsharp-dotnet-cli-samples/wiki/Getting-Started#hello-world to get started with f# and dotnet core on my mac.
% mkdir helloworld % cd helloworld % dotnet new --lang "f#" Created new F# project in /Users/User/dotnet/helloworld. % ls Program.fs project.json
Here, I can already tell, that there is no NuGet.Config as outlined in the tutorial I followed. Then
% dotnet restore log : Restoring packages for /Users/User/dotnet/helloworld/project.json... log : Restoring packages for tool 'dotnet-compile-fsc' in /Users/User/dotnet/helloworld/project.json... log : Writing lock file to disk. Path: /Users/User/dotnet/helloworld/project.lock.json log : /Users/User/dotnet/helloworld/project.json log : Restore completed in 2148ms. % dotnet run Project helloworld (.NETCoreApp,Version=v1.1) will be compiled because expected outputs are missing Compiling helloworld for .NETCoreApp,Version=v1.1 The specified framework 'Microsoft.NETCore.App', version '1.0.0' was not found. - Check application dependencies and target a framework version installed at: /usr/local/share/dotnet/shared/Microsoft.NETCore.App - The following versions are installed: 1.1.0 - Alternatively, install the framework version '1.0.0'. /usr/local/share/dotnet/dotnet compile-fsc @/Users/User/dotnet/helloworld/obj/Debug/netcoreapp1.1/dotnet-compile.rsp returned Exit Code 131 Compilation failed. 0 Warning(s) 0 Error(s) Time elapsed 00:00:00.4439997
Dotnet info says
% dotnet --info .NET Command Line Tools (1.0.0-preview2-1-003177) Product Information: Version: 1.0.0-preview2-1-003177 Commit SHA-1 hash: a2df9c2576 Runtime Environment: OS Name: Mac OS X OS Version: 10.12 OS Platform: Darwin RID: osx.10.12-x64
I had a similar issue before when creating the F# project using dotnet new --lang "f#"
The problem is this dependency, which you should see in you project.json
file: dotnet-compile-fsc .
"tools": {
"dotnet-compile-fsc": "1.0.0-preview2.1-*"
},
At the time of writing this only supports the .Net Core 1.0.* runtime, not the .Net Core 1.1.* runtime you have installed.
To fix this you can install the .Net Core 1.0.* runtime from here and run dotnet run
again. Both the 1.1.* and 1.0.* runtimes can be installed locally without issue.
For reference, here is the issue reported on GitHub . There is a fix but it's not on NuGet yet.
The current dotnet-compile-fsc
doesnt work yet with .NET Core 1.1 (current, sdk preview2.1), only with .NET Core 1.0 (LTS, sdk preview2).
You can workaround doing the dotnet restore
like the following, using the dev feed because the new package is not yet on nuget.org
dotnet restore -f https://www.myget.org/F/netcorecli-fsc-preview2-1/api/v3/index.json
see https://github.com/dotnet/netcorecli-fsc/wiki/.NET-Core-SDK-preview2.1 for more info/workaround
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.