4

我试图按照https://github.com/enricosada/fsharp-dotnet-cli-samples/wiki/Getting-Started#hello-world在我的 Mac 上开始使用 f# 和 dotnet core。

% mkdir helloworld
% cd helloworld
% dotnet new --lang "f#"
在 /Users/User/dotnet/helloworld 中创建了新的 F# 项目。
%ls
Program.fs 项目.json

在这里,我已经可以看出,没有我遵循的教程中概述的 NuGet.Config。然后

% dotnet 还原
日志:恢复 /Users/User/dotnet/helloworld/project.json 的包...
日志:在 /Users/User/dotnet/helloworld/project.json 中恢复工具 'dotnet-compile-fsc' 的包...
log :将锁定文件写入磁盘。路径:/Users/User/dotnet/helloworld/project.lock.json
日志:/Users/User/dotnet/helloworld/project.json
log : 恢复在 2148 毫秒内完成。
% 点网运行
项目 helloworld (.NETCoreApp,Version=v1.1) 将被编译,因为缺少预期的输出
为 .NETCoreApp 编译 helloworld,Version=v1.1
找不到指定的框架“Microsoft.NETCore.App”,版本“1.0.0”。
  - 检查应用程序依赖项并定位安装在以下位置的框架版本:
      /usr/local/share/dotnet/shared/Microsoft.NETCore.App
  - 安装了以下版本:
      1.1.0
  - 或者,安装框架版本“1.0.0”。
/usr/local/share/dotnet/dotnet compile-fsc @/Users/User/dotnet/helloworld/obj/Debug/netcoreapp1.1/dotnet-compile.rsp 返回退出代码 131

编译失败。
    0 个警告
    0 错误

经过时间 00:00:00.4439997

点网信息 说

% dotnet --info
.NET 命令行工具 (1.0.0-preview2-1-003177)

产品信息:
 版本:1.0.0-preview2-1-003177
 提交 SHA-1 哈希:a2df9c2576

运行环境:
 操作系统名称:Mac OS X
 操作系统版本:10.12
 操作系统平台:达尔文
 RID:osx.10.12-x64
4

2 回答 2

2

在使用创建 F# 项目之前,我遇到了类似的问题dotnet new --lang "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 上。

于 2017-01-09T22:49:37.157 回答
1

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

您可以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

于 2017-01-16T12:54:12.973 回答