fsprojects / FSharp.Data

F# Data: Library for Data Access
https://fsprojects.github.io/FSharp.Data
Other
806 stars 288 forks source link

Project fails to find FSharp.Core anytime I try to compile with a reference to FSharp.Data #1220

Open Disco-Dave opened 5 years ago

Disco-Dave commented 5 years ago

I'm not sure if this the correct place to ask, because I don't think this is caused by FSharp.Data, however I was hoping somewhere here could help me out.

System Information

Reproduction steps

  1. dotnet new console -lang F# -n TryToCompileWithFsharpData && cd TryToCompileWithFsharpData
  2. dotnet build -> This works
  3. dotnet add package FSharp.Data
  4. dotnet build then I get the following errors

    
    Microsoft (R) Build Engine version 15.8.169.62826 for .NET Core
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Restoring packages for /home/disco/Documents/code/TryToCompileWithFsharpData/TryToCompileWithFsharpData.fsproj...
    Restore completed in 152.1 ms for /home/disco/Documents/code/TryToCompileWithFsharpData/TryToCompileWithFsharpData.fsproj.
    error FS3031 : The type provider '/home/disco/.nuget/packages/fsharp.data/3.0.0/lib/netstandard2.0/FSharp.Data.dll' reported an error : Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Data.DesignTime' which cannot be loaded or doesn't exist. Could not load file or assembly 'FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. [/home/disco/Documents/code/TryToCompileWithFsharpData/TryToCompileWithFsharpData.fsproj]
    FSC : warning FS3005: Referenced assembly '/home/disco/.nuget/packages/fsharp.data/3.0.0/lib/netstandard2.0/FSharp.Data.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found [/home/disco/Documents/code/TryToCompileWithFsharpData/TryToCompileWithFsharpData.fsproj]

Build FAILED.

FSC : warning FS3005: Referenced assembly '/home/disco/.nuget/packages/fsharp.data/3.0.0/lib/netstandard2.0/FSharp.Data.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found [/home/disco/Documents/code/TryToCompileWithFsharpData/TryToCompileWithFsharpData.fsproj] error FS3031 : The type provider '/home/disco/.nuget/packages/fsharp.data/3.0.0/lib/netstandard2.0/FSharp.Data.dll' reported an error : Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Data.DesignTime' which cannot be loaded or doesn't exist. Could not load file or assembly 'FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. [/home/disco/Documents/code/TryToCompileWithFsharpData/TryToCompileWithFsharpData.fsproj] 1 Warning(s) 1 Error(s)


The .fsproj file

```<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

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

  <ItemGroup>
    <PackageReference Include="FSharp.Data" Version="3.0.0" />
  </ItemGroup>

</Project>
SebastianS90 commented 5 years ago

See also dotnet/netcorecli-fsc#123

It looks like the issue appears on Arch Linux only, therefore I opened a bug report there.

halfbro commented 5 years ago

I was working on a project and started encountering this issue. I'm using Arch Linux with the dotnet-sdk repo package and fsharp AUR package.

It turns out that the dotnet-sdk package is pretty out of date, and it uses SDK 2.2.105.

I updated the SDK by going to https://dotnet.microsoft.com/download/dotnet-core/2.2 and installing the latest version (2.2.300 at the time of this post). To install, I copied the tar file to /opt/dotnet (default location for the repo package), then extracted the whole file in place. This added the necessary folders to sdk, host, and shared, from what I can tell.

I tried building again using dotnet build at my project's root and everything worked, whereas before I was getting the same error you described.

So it seems the actual solution is to manually update your sdk version using the steps above, since the issue has been fixed, but no updates were pushed for Arch Linux. Perhaps someone could make an AUR package to do those steps automatically?

pgeadas commented 4 years ago

This did solve the problem for me as well.

Thanks!

Slesa commented 8 months ago

I have the same problem on Windows using .NET 4.8 (which I cannot simply convert). What can I do?