Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fantomas fails in Fake script #439

Closed
tforkmann opened this issue May 9, 2019 · 4 comments
Closed

Fantomas fails in Fake script #439

tforkmann opened this issue May 9, 2019 · 4 comments

Comments

@tforkmann
Copy link

Description

I tried to add Fantomas to my FakeScript but I'm getting the following error message.

Starting target 'CheckCodeFormat'
Redirect assembly from 'FSharp.Core, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' to previous loaded assembly 'FSharp.Core, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Redirect assembly from 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' to previous loaded assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Trying to resolve: FSharp.Compiler.Service, Version=25.0.1.0, Culture=neutral, PublicKeyToken=null
Could not find assembly in the default load-context: FSharp.Compiler.Service, Version=25.0.1.0, Culture=neutral, PublicKeyToken=null
Redirect assembly from 'FSharp.Compiler.Service, Version=25.0.1.0, Culture=neutral, PublicKeyToken=null' to 'FSharp.Compiler.Service, Version=28.0.0.0, Culture=neutral, PublicKeyToken=null' (Some
  "C:\Users\tforkmann\.nuget\packages\fsharp.compiler.service\28.0.0\lib\netstandard2.0\FSharp.Compiler.Service.dll")
Redirect assembly load to previously loaded assembly: netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

What Am I doing wrong?

Repro code

// --------------------------------------------------------------------------------------
// CheckCodeFormat and then Format with Fantomas
// --------------------------------------------------------------------------------------

let fantomasConfig =
{ FormatConfig.Default with
ReorderOpenDeclaration = true }

Target.create "CheckCodeFormat" (fun _ ->
!! "src/**/*.fs"
|> checkCode fantomasConfig
)

Target.create "Format" (fun _ ->
!! "src/**/*.fs"
|> formatCode fantomasConfig
|> printfn "Formatted files: %A"
)

It seems like FSharp.Compiler.Tools is missing. Should I manually add it?

@nojaf
Copy link
Contributor

nojaf commented May 9, 2019

Hey Tim, what info do you have about FSharp.Compiler.Service in your paket lock file?
Maybe a higher version is listed there and Fantomas isn't compatible.
In 27 there were some breaking changes for example.

@tforkmann
Copy link
Author

tforkmann commented May 9, 2019

Hey Florian,

this is a extract out of my paket lock file:

Fantomas (2.9.2)
      FSharp.Compiler.Service (>= 25.0.1)
FParsec (1.0.3)
      FSharp.Core (>= 4.2.3)
      NETStandard.Library (>= 1.6.1)
FSharp.Compiler.Service (28.0)

@jindraivanek
Copy link
Contributor

@tforkmann Different FSharp.Compiler.Service version than the one Fantomas is using can cause problems. See #315 (comment) for older case. You can try workarounds mentioned there for version 25.0.1, or you can try early build of Fantomas that should use version 28.0

@nojaf
Copy link
Contributor

nojaf commented Aug 9, 2019

The latest beta now uses the FCS 30, which is the latest at the time of writing.
I'm going to close this for now as don't think there is any action for us left here.
Feel free to re-open if we missed anything.

@nojaf nojaf closed this as completed Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants