dotnet-websharper / core

WebSharper - Full-stack, functional, reactive web apps and microservices in F# and C#
https://websharper.com
Apache License 2.0
598 stars 50 forks source link

Cannot compile after switching to Paket #497

Closed vasily-kirichenko closed 8 years ago

vasily-kirichenko commented 8 years ago
...\packages\WebSharper\build\WebSharper.targets(60,5): 
error : Failed to deserialize metadata for: WebSharper.Suave, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null
Tarmil commented 8 years ago

What versions of WebSharper and WebSharper.Suave do you have referenced?

Also, are you running from within an IDE? If so, there might be issues with the IDE still referencing an old WebSharper.MSBuild.dll, so you should try closing it and reopening it.

vasily-kirichenko commented 8 years ago

Restarting VS has not helped.

packages.config with which everything compiled and works OK:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="ExtCore" version="0.8.45" targetFramework="net45" />
  <package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
  <package id="Mono.Cecil" version="0.9.6.1" targetFramework="net45" />
  <package id="Owin" version="1.0" targetFramework="net45" />
  <package id="Suave" version="0.33.0" targetFramework="net45" />
  <package id="WebSharper" version="3.6.2.220" targetFramework="net45" />
  <package id="WebSharper.Owin" version="3.6.1.115" targetFramework="net45" />
  <package id="WebSharper.Suave" version="3.6.1.22" targetFramework="net45" />
  <package id="WebSharper.UI.Next" version="3.6.2.196" targetFramework="net45" />
</packages>

paket.lock

REDIRECTS: ON
FRAMEWORK: NET45, NET451, NET452, NET46
NUGET
  remote: https://nuget.org/api/v2
  specs:
    ExtCore (0.8.45)
    FSharp.Core (3.1.2.5)
    FsWebAddRegistryEntries (0.1.0.0)
    Microsoft.AspNet.Mvc (5.2.2)
      Microsoft.AspNet.Razor (>= 3.2.2 < 3.3.0)
      Microsoft.AspNet.WebPages (>= 3.2.2 < 3.3.0)
    Microsoft.AspNet.Razor (3.2.3)
    Microsoft.AspNet.Web.Optimization (1.1.3)
      Microsoft.Web.Infrastructure (>= 1.0.0)
      WebGrease (>= 1.5.2)
    Microsoft.AspNet.WebApi (5.0.0)
      Microsoft.AspNet.WebApi.WebHost (>= 5.0.0)
    Microsoft.AspNet.WebApi.Client (5.2.3)
      Newtonsoft.Json (>= 6.0.4)
    Microsoft.AspNet.WebApi.Core (5.2.3)
      Microsoft.AspNet.WebApi.Client (>= 5.2.3)
    Microsoft.AspNet.WebApi.WebHost (5.2.3)
      Microsoft.AspNet.WebApi.Core (>= 5.2.3 < 5.3.0)
    Microsoft.AspNet.WebPages (3.2.3)
      Microsoft.AspNet.Razor (>= 3.2.3 < 3.3.0)
      Microsoft.Web.Infrastructure (>= 1.0.0.0)
    Microsoft.Data.Edm (5.6.3)
    Microsoft.Data.OData (5.6.3)
      Microsoft.Data.Edm (5.6.3)
      System.Spatial (5.6.3)
    Microsoft.Data.Services.Client (5.6.3)
      Microsoft.Data.OData (5.6.3)
    Microsoft.Owin (3.0.1)
      Owin (>= 1.0)
    Microsoft.Web.Infrastructure (1.0.0.0)
    Mono.Cecil (0.9.6.1)
    MSBuild.Extension.Pack (1.3.0)
    Newtonsoft.Json (7.0.1)
    Owin (1.0.0)
    Paket (1.21.1)
    Strathweb.CacheOutput.WebApi2 (0.6)
      Microsoft.AspNet.WebApi.Client (>= 5.2.2)
      Microsoft.AspNet.WebApi.Core (>= 5.2.2)
    Suave (0.33)
      FSharp.Core (>= 3.1.2.5)
    System.Spatial (5.6.3)
    WebGrease (1.6.0)
      Antlr (>= 3.4.1.9004)
      Newtonsoft.Json (>= 5.0.4)
    WebSharper (3.6.2.220)
    WebSharper.Owin (3.6.1.115)
      Microsoft.Owin (>= 3.0.1)
      Owin (>= 1.0)
      WebSharper (>= 3.6.2.220)
    WebSharper.Suave (3.4.8.11)
      Suave
      WebSharper
      WebSharper.Owin
    WebSharper.UI.Next (3.6.2.196)
      WebSharper (>= 3.6.2.220)
    WindowsAzure.Storage (4.3.0)
      Microsoft.Data.OData (>= 5.6.2)
      Microsoft.Data.Services.Client (>= 5.6.2)
      Microsoft.WindowsAzure.ConfigurationManager (>= 1.8.0.0)
      Newtonsoft.Json (>= 5.0.8)

paket.references

ExtCore
Microsoft.Owin
Mono.Cecil
Owin
Suave
WebSharper
WebSharper.Owin
WebSharper.Suave
WebSharper.UI.Next

Paket pin WebSharper.Suave to version 3.4.8.11, but initially it was 3.6.1.22. Hmm.

vasily-kirichenko commented 8 years ago

After I pin the right version to WebSharper.Suave, paket.lock for it looks like this:

WebSharper.Suave (3.6.1.22)
      Mono.Cecil (>= 0.9.6.1)
      Suave (>= 0.33.0)
      WebSharper (>= 3.6.2.220)
      WebSharper.Owin (>= 3.6.1.115)

Now the project compiles, but crashes on startup:

Unhandled Exception: System.MissingMethodException: Method not found: 'Microsoft.FSharp.Core.FSharpFunc2<HttpContext,Microsoft.FSharp.Control.FSharpAsync1<Microsoft.FSharp.Core.FSharpOption1<HttpContext>>> WebSharper.Suave.WebSharperAdapter.ToWebPart(WebSharper.Sitelets.Sitelet1<!!0>, Microsoft.FSharp.Core.FSharpOption1<System.String>, Microsoft.FSharp.Core.FSharpOption1)'. at <StartupCode$Monitor-Web>.$Main.main@()

vasily-kirichenko commented 8 years ago

Solved it. It's necessary to reference FSharp.Core package and delete old static ref on FSharp.Core.dll from project file. paket install adds the following:

<Choose>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.6')">
      <ItemGroup>
        <Reference Include="FSharp.Core">
          <HintPath>..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
      </ItemGroup>
    </When>
  </Choose>
  <Choose>

And you must find and delete this:

 <TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion>

and this:

<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <Private>True</Private>
</Reference>