繁体   English   中英

在Mac上使用dotnet CLI上的f#

[英]Using f# on a mac with the dotnet cli

我试图遵循https://github.com/enricosada/fsharp-dotnet-cli-samples/wiki/Getting-Started#hello-world在Mac上开始使用f#和dotnet核心。

% mkdir helloworld
% cd helloworld
% dotnet new --lang "f#"
Created new F# project in /Users/User/dotnet/helloworld.
% ls
Program.fs   project.json

在这里,我已经知道,按照我所遵循的教程中的概述,没有NuGet.Config。 然后

% 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
.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

使用dotnet new --lang "f#"创建F#项目之前,我遇到了类似的问题

问题是这种依赖性,您应该在project.json文件中看到: dotnet-compile-fsc

"tools": {
    "dotnet-compile-fsc": "1.0.0-preview2.1-*"
},

在撰写本文时,它仅支持.Net Core 1.0。*运行时,而不支持已安装的.Net Core 1.1。*运行时。

要解决此问题,您可以从此处安装.Net Core 1.0。*运行时,然后再次运行dotnet run 1.1。*和1.0。*运行时都可以在本地安装而不会出现问题。

供参考, 这是在GitHub上报告的问题 有一个修复程序,但尚未在NuGet上进行。

当前的dotnet-compile-fsc不适用于.NET Core 1.1(当前,sdk Preview2.1),仅适用于.NET Core 1.0(LTS,sdk Preview2)。

您可以使用dev feed来解决以下那样的dotnet restore ,因为新软件包尚未在nuget.org上

dotnet restore -f https://www.myget.org/F/netcorecli-fsc-preview2-1/api/v3/index.json

有关更多信息/解决方法,请参见https://github.com/dotnet/netcorecli-fsc/wiki/.NET-Core-SDK-preview2.1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM