.NET Core SDK 1.0.1

Enrico Sada edited this page Jun 13, 2017 · 12 revisions

Patch version of the 1.0

Links for installation:

The sdk binaries/installer include both .NET Core runtimes branches, the LTS 1.0.4 and the Current 1.1.1

NOTE you need the sdk. The runtime binaries/installer doesnt include the sdk, so cannot be used to build projects, just to run already built projects.

Use the simpler instructions but add -lang f# to dotnet new

The Announcement msdn blog post

F# works after install all supported os, minus ubuntu 16.10.

For ubuntu 16.10, ref dotnet/netcorecli-fsc#91 issue for status updates

To check version, you can run

dotnet --version

and the output should be 1.0.1

An quickstart, to create a console app and run it:

dotnet new console -lang f#
dotnet restore
dotnet run

To run an ASP.NET Core app, is the same, just use another template

dotnet new mvc -lang f#
dotnet restore
dotnet run

You can do dotnet new -all -lang f# to show all f# templates (plus common)

To use Visual Studio Code using Ionide, with full intellisense and debug, require the project to be restored (dotnet restore)

dotnet new lib -lang f#
dotnet restore
code .

Notes

To help in converting from project.json to msbuild based .fsproj, usually dotnet migrate is enough, but has some issues with f#, see below for workaround.

Also good this post for information about the equivalent options in each format.

Known issues

dotnet-migrate

dotnet migrate doesnt support F# yet:

error on build/pack using multiple frameworks (<TargetFrameworks>)

Using <TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks> the dotnet build/pack fails. It's normal.

  • WORKAROUND: pass runtime to build net451, for example -r win7-x64

using .NET Framework as targets framework, the osx/unix build fails

Use a .net framwork (not core) like <TargetFramework>net451</TargetFramework> (or in TargetFrameworks) the dotnet build/pack fails on osx/unix, instead on windows work

  • ISSUE: https://github.com/dotnet/sdk/issues/335

  • WORKAROUND: see issue, if applicable

  • WORKAROUND (with mono installed): set FrameworkPathOverride environment variable to use .net framework assemblies installed by mono

    Find where .../mono/4.5/mscorlib.dll is on your machine and set FrameworkPathOverride as an environment variable

    • Easiest if mono is already on your path

      export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5/
      
    • OSX (assuming mono install with xamarin studio):

      export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/4.6.2/lib/mono/4.5/
      
    • OSX (assuming mono installed with brew):

      export FrameworkPathOverride=/usr/local/Cellar/mono/4.6.2.16/lib/mono/4.5/
      
    • Debian:

      export FrameworkPathOverride=/usr/lib/mono/4.5/
      

    You can then build by specifying the target framework and runtime identifier (run will not work):

    dotnet build -f net462 --runtime osx.10.11-x64
    

    To know the runtime id, just do dotnet --info Or you can set the RuntimeIdentifier environment variable like so:

    export RuntimeIdentifier=$(dotnet --info | grep "RID" | awk '{print $2}')
    

cannot produce full pdb

Using <DebugType>full</DebugType> doesnt produce full pdb. no error/warning and no pdb is created. fsc built for .net core doesnt support that scenario, ref https://github.com/Microsoft/visualfsharp/issues/2565

.NET Core 1.1.1 for Ubuntu 16.10 fails to build F# projects

Use the .NET Core 1.0.4 download for Ubuntu 16.04 instead (works on Ubuntu 16.10). ref dotnet/netcorecli-fsc#91 issue for status updates

IDE Support

  • VS Code with F# Ionide ( version >= 2.25.1 ) extension: ok (build/run/intellisense,debug)
    • NOTE: the VSCode require a dotnet restore
  • vim: yes
  • emacs: yes
  • VS On Mac: yes
  • VS 2017: no
  • Notepad and cli: from day 0 all dotnet sdk commands, ok (new,restore/build/run/pack/publish/test), ko (migrate)

Changes from rc4

None, but if your fsproj was based on rc4 dotnet new template you show check dotnet new again for diff.

In pratice, you should:

  • remove <DotNetCliToolReference Include="dotnet-compile-fsc" .. />

  • remove <Version .. is not mandatory in fsproj, you can pass it from command line with /p:Version=1.2.3-rc1

  • remove <EnableDefaultCompileItems ..>

  • remove <EmbeddedResource Include="**\*.resx" /> that's the default, all resx are included

  • change <PackageReference Include="FSharp.NET.Sdk" Version="1.0.0-beta-*" > use Version=1.0.*

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

    add add instead

    <PackageReference Include="FSharp.Core" Version="4.1.*" /> instead

    the Microsoft.FSharp.Core.netcore is deprecated