【问题标题】:Using f# on a mac with the dotnet cli在带有 dotnet cli 的 mac 上使用 f#
【发布时间】:2017-04-09 11:45:54
【问题描述】:

我试图关注 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 信息说

% 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

【问题讨论】:

  • 那些说明提到(在顶部)安装 .Net Core Preview 1。但 github.com/dotnet/cli/releases 列出了 Preview 3,其 release announcement 提到他们正在远离 project.json 并返回.csproj 格式,尽管它是 .csproj 格式,显然比以前的样子大大简化了。也许您只需将 .NET CLI 工具更新到 1.0 预览版 3 并重试?

标签: .net f# dotnet-cli


【解决方案1】:

我之前在使用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.* 运行时。

要解决此问题,您可以 install the .Net Core 1.0.* runtime from here 并再次运行 dotnet run。 1.1.* 和 1.0.* 运行时都可以在本地安装而不会出现问题。

供参考,here is the issue reported on GitHub。有一个修复,但它还没有在 NuGet 上。

【讨论】:

    【解决方案2】:

    当前的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 了解更多信息/解决方法

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-10
      • 2020-09-22
      • 1970-01-01
      相关资源
      最近更新 更多