我可以在 .Net Framework 4.8 上引用 FSharp.Data 版本 >= 4.0 吗?

Can I reference FSharp.Data version >= 4.0 on .NetFramework 4.8?

我的项目在 .NetFramework 4.8 上运行,并且(在其他包中)依赖于 FSharp.Data 3.3.3。

我正在尝试升级软件包,但出现错误:

*Error FS3031: The type provider '\packages\FSharp.Data\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.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.*

*FSC : error FS3031: The type provider 'G:\packages\FSharp.Data\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.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. [G:\Kernel\Project\Project.Tests.fsproj]*

我注意到对于 FSharp.Data 版本 >= 4.0,该软件包是为 .NetStandard2.0 构建的,但据我所知,这应该不是问题。

3.3.3版本为我编译,包中net45版本和nestandard2.0版本。

我的包裹使用小包。

我尝试引用 FSharp.Data.DesignTime.dll,但没有成功。

.fsproj:

    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>46274688-4815-444d-b237-9aeec92ef3e6</ProjectGuid>
    <OutputType>Library</OutputType>
    <RootNamespace>Project.Tests</RootNamespace>
    <AssemblyName>Project.Tests</AssemblyName>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <Name>Project.Tests</Name>
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
    <TargetFSharpCoreVersion>6.0.0.0</TargetFSharpCoreVersion>
    <TargetFrameworkProfile />
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

项目的app.config是这样的:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
  </startup>
  
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <Paket>True</Paket>
    <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="6.0.0.0" />
  </dependentAssembly>
</assemblyBinding></runtime></configuration>

我可能遗漏了一些明显的东西,但我已经尝试 google 这几天了。 有没有人在 .NetFramework 4.8 上成功使用这个包?

我刚刚使用 .NET Framework 4.8 和 FSharp.Data 4.2.3 创建了一个新的控制台应用程序,没问题。

我注意到您正在重定向到 FSharp.Core 6.0.0。你确定要那个吗?

无论如何,我的 .fsproj 是:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net48</TargetFramework> 

    <WarnOn>3390;$(WarnOn)</WarnOn>
  </PropertyGroup>

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

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

而且没有app.config。