【问题标题】:F# on macOS - Fake fails to buildmacOS 上的 F# - Fake 无法构建
【发布时间】:2018-05-03 21:02:21
【问题描述】:

尝试在 macOS High Sierra 上构建简单的 F# 项目时出现错误。

$ mono --version
Mono JIT compiler version 5.0.1.1 (2017-02/5077205 Sun Sep 17 18:29:46 BST 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen (concurrent by default)

步骤:

  1. 打开 VS 代码
  2. Ionide 新 F# 项目
  3. 选择 Suave 项目模板
  4. $ mono .paket/paket.exe install
  5. $ ./build.sh

错误是:

1) System.Exception: dotnet build failed
at FSI_0005.Build+runDotnet@40.Invoke (System.String message) [0x00001] in <c9993ec69ddb4848af99438005012ea7>:0 
at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv`1[TResult].Finalize () [0x00012] in <5893d081904cf4daa745038381d09358>:0 
at Microsoft.FSharp.Core.PrintfImpl+Final1@224[TState,TResidue,TResult,A].Invoke (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] env, A a) [0x00038] in <5893d081904cf4daa745038381d09358>:0 
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5893d081904cf4daa745038381d09358>:0 
at FSI_0005.Build.runDotnet (System.String workingDir, System.String args) [0x00048] in <c9993ec69ddb4848af99438005012ea7>:0 
at FSI_0005.Build+clo@64-6.Invoke (System.String p) [0x0000a] in <c9993ec69ddb4848af99438005012ea7>:0 
at Microsoft.FSharp.Collections.SeqModule.Iterate[T] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] action, System.Collections.Generic.IEnumerable`1[T] source) [0x0002d] in <5893d081904cf4daa745038381d09358>:0 
at FSI_0005.Build+clo@62-5.Invoke (Microsoft.FSharp.Core.Unit _arg4) [0x0000b] in <c9993ec69ddb4848af99438005012ea7>:0 
at Fake.TargetHelper+targetFromTemplate@209-1[a].Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00001] in <59b649fdccf1c534a7450383fd49b659>:0 
at Fake.TargetHelper.runSingleTarget (Fake.TargetHelper+TargetTemplate`1[a] target) [0x0004b] in <59b649fdccf1c534a7450383fd49b659>:0 

我怎样才能让它工作?

【问题讨论】:

    标签: f# macos-high-sierra f#-fake


    【解决方案1】:

    默认情况下,Ionide 没有选择正确的目标框架。

    您需要进行以下更改:

    1. *.fsproj,把目标框架改成:

      <TargetFramework>netcoreapp2.0</TargetFramework>
      
    2. paket.dependencies,把框架改成:

      framework: >= netcoreapp2.0
      

    再次运行Paket:

    $ mono .paket/paket.exe install 
    

    再次运行构建脚本:

    $ ./build.sh 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-13
      • 1970-01-01
      • 1970-01-01
      • 2022-10-02
      • 1970-01-01
      • 2019-02-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多