dotnet / netcorecli-fsc

[DEPRECATED] F# and .NET Core SDK working together

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cleanup fsproj

enricosada opened this issue · comments

Track proposed/wip changes to csproj/fsproj in preview5

All default behaviour from .net or in f# should be overridable.

Current preview4

<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk" ToolsVersion="15.0">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.0</TargetFramework>
    <Version>1.0.0-alpha</Version>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.fs" />
    <EmbeddedResource Include="**\*.resx" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
    <PackageReference Include="Microsoft.FSharp.Core.netcore" Version="1.0.0-alpha-161023" />
    <PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*">
      <PrivateAssets>All</PrivateAssets>
    </PackageReference>
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="dotnet-compile-fsc">
      <Version>1.0.0-preview2-020000</Version>
    </DotNetCliToolReference>
  </ItemGroup>

</Project>

TODO:

  • Remove <EmbeddedResource Include="**\*.resx" /> will be inside Microsoft.NET.Sdk (ref dotnet/sdk#468 ). Ok the default of .net sdk
  • Probably set OverrideDefaultCompileGlob = true when implicit globs are added in .props inside FSharp.Sdk, so <Compile Include="**\*.cs" is not added by default
  • <PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*"> should go inside FSharp.Sdk package
  • Remove dotnet-compile-fsc (ref #25)
    • choose how to run fsc (clitool?)

After (with sdk implicit globals, future work etc):

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

  <PropertyGroup>
    <TargetFramework>netcoreapp1.0</TargetFramework>
  </PropertyGroup>

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

  <ItemGroup>
    <PackageReference Include="Microsoft.FSharp.Core.netcore" Version="1.0.0-alpha-161023" />
  </ItemGroup>

</Project>

I must say, that the "after" version is starting to look pretty great! Very minimal.

Yes, not bad ihmo. And pretty much all these changes are language agnostic .net msbuild improvements atm.

Maybe we can also think to add F# specific improvements like some defines by defaults, but no ideas atm ( @dsyme @cartermp ideas about that? or just exactly like old fsproj? )

It's also possibile to implicit add the FSharp.Core package as PackageReference (version can be from a defaulted property, and can be removed obv) but i think it's not a good idea because package versioning magic should be avoided if possibile (with or without Paket). And is just one line.

Done.

final 1.0.0 examples in https://github.com/dotnet/netcorecli-fsc/tree/master/examples/rc4

Example lib fsproj:

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

  <PropertyGroup>
    <TargetFramework>netstandard1.6</TargetFramework>
  </PropertyGroup>

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

  <ItemGroup>
    <PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
    <PackageReference Include="FSharp.Core" Version="4.1.*" />
  </ItemGroup>

</Project>