fsprojects / FSharp.Formatting

F# tools for generating documentation (Markdown processor and F# code formatter)
https://fsprojects.github.io/FSharp.Formatting/
Other
462 stars 155 forks source link

Consider targetting .NET 6 as well #799

Closed kMutagene closed 1 year ago

kMutagene commented 1 year ago

since v17, fsdocs-tool only supports .NET 7. This can cause problems especially in projects where FAKE is being used, as FAKE targets .NET6 and will not work due to incompatible msbuild log formats when running with the .NET 7 sdk. Should there be no .NET 7 exclusive code i'd suggest multi-targetting frameworks here:

https://github.com/fsprojects/FSharp.Formatting/blob/e665aa95ab897e5e2c543e5847f3820b3e215e92/src/fsdocs-tool/fsdocs-tool.fsproj#L6

to

 <TargetFrameworks>net6.0;net7.0</TargetFrameworks>

or even only targetting .net 6, as that is the LTS release anyways

nojaf commented 1 year ago

Hello,

Thank you for bringing this up. This may not be possible because we depend on MSBuild bits for project cracking. @baronfel any thoughts?

TheAngryByrd commented 1 year ago

I think it's possible but we need to set the Microsoft.Build to copy_local: false.

# copy_local: false excludes runtime assets (desired for msbuild)
nuget Microsoft.Build copy_local: false
nuget Microsoft.Build.Framework copy_local: false
nuget Microsoft.Build.Utilities.Core copy_local: false
nuget Microsoft.Build.Tasks.Core copy_local: false

https://github.com/ionide/proj-info/issues/178

nojaf commented 1 year ago

We would first need to have https://github.com/fsprojects/FSharp.Formatting/pull/796 right? As our current version of FCS would pull down those dependencies anyway.

TheAngryByrd commented 1 year ago

We would first need to have #796 right? As our current version of FCS would pull down those dependencies anyway.

I don't think we need it for just this. The dependencies for Ionide.ProjInfo.FCS are FSharp.Compiler.Service(>= 41.0.5)

image
nojaf commented 1 year ago

Yeah, until you actually install it. Tried this console app:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <RootNamespace>oh_jimmy</RootNamespace>
     <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.fs" />
  </ItemGroup>

  <ItemGroup>
  <PackageReference Include="Ionide.ProjInfo.FCS" Version="0.61.2" />
  <PackageReference Update="FSharp.Core" Version="6.0.5" />
</ItemGroup>
</Project>

Lock file says:

      "FSharp.Compiler.Service": {
        "type": "Transitive",
        "resolved": "41.0.5",
        "contentHash": "p88YDZYJCnuQRqnWnN9kcklHzEVy0vEEnjZ0e+/fszAASEInoAzkfs4SxTTrgsw7ey+hmbkjYjvcbC8Ed1Xa4Q==",

and build output looks like: image

I do think we need the latest FCS to get around that problem.

When I add:

  <PackageReference Update="FSharp.Core" Version="7.0.200" />
  <PackageReference Include="FSharp.Compiler.Service" Version="43.7.200" />

I don't get those MSBuild dlls.

TheAngryByrd commented 1 year ago

Oh because this project is on 42.7.101, yep, we need to get off that version. (Wonder if they should unlist it?)

TheAngryByrd commented 1 year ago

And looks like this project doesn't need Ionide.ProjInfo.FCS, just Ionide.ProjInfo and Ionide.ProjInfo.Sln so that's good.

nojaf commented 1 year ago

Available in https://www.nuget.org/packages/fsdocs-tool/18.0.0