Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

How to migrate preview2 projects to rc4

Enrico Sada edited this page Feb 16, 2017 · 1 revision

The dotnet-migrate is the sdk tool to convert preview2 projects (project.json/xproj) to rc4 (fsproj, msbuild based)

It's invoked like dotnet migrate in the project directory

The dotnet-migrate doesnt support F# yet.

It's just not implemented yet, see dotnet/netcorecli-fsc#38 and up-for-grab (nice for new contributors) if someone want to fix that.

As workaround:

  1. Normalize F# as C#

    • In project.json remove "compilerName": "fsc",
  2. If multiple projects, repeat 1. for all project referenced (migrate will convert all referenced projects)

  3. dotnet migrate it!

  4. Rename the created {yourproject}.csproj in {yourproject}.fsproj

  5. Normalize C# .csproj as F# .fsproj

    • Fix Sdk Attribute, adding prefix FSharp.NET.Sdk; like

      <Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
    • Remove Microsoft.FSharp.Core.netcore PackageReference

    • Add FSharp.NET.Sdk package (the F# msbuild integration) and FSharp.Core

      <ItemGroup>
          <PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
          <PackageReference Include="FSharp.Core" Version="4.1.*" />
      </ItemGroup>
  6. If multiple projects, fix <ProjectReference path from .csproj to .fsproj

That's it. As usual now:

  • dotnet restore
  • dotnet build or dotnet run or dotnet test