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 preview3

Enrico Sada edited this page Nov 17, 2016 · 3 revisions

The dotnet-migrate is the sdk tool to convert preview2 projects (project.json/xproj) to preview3 (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. It's up-for-grab (nice for new contributors) if someone want to fix that.

As workaround:

  1. Normalize F# as C# (see diff)
    • In project.json remove "compilerName": "fsc",
    • Make sure the dotnet-compile-fsc version is "dotnet-compile-fsc":"1.0.0-preview2-020000" (NOTE not -* but -020000)
  2. dotnet migrate it!
  3. Rename the created {yourproject}.csproj in {yourproject}.fsproj
  4. Normalize C# .csproj as F# .fsproj (see diff)
    • Add FSharp.NET.Sdk package (the F# msbuild integration)

      <ItemGroup>
          <PackageReference Include="FSharp.NET.Sdk">
          <Version>1.0.0-alpha-*</Version>
          <PrivateAssets>All</PrivateAssets>
          </PackageReference>
      </ItemGroup>
    • Remove the wildcard include of .cs files

      <Compile Include="**\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
    • Replace

      <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

      with

      <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />

That's it. As usual now:

  • dotnet restore
  • dotnet build
  • dotnet run