FSharp.TypeProviders.SDK icon indicating copy to clipboard operation
FSharp.TypeProviders.SDK copied to clipboard

Wrong version of FSharp.TypeProviders.SDK is required when using a nuget package

Open AlexeyRaga opened this issue 3 years ago • 2 comments

Description

Env: .NET6, F# 6, MacOS, no packet

When creating a new provider and referencing FSharp.TypeProviders.SDK 7.0.3 from Nuget, getting the following compilation error:

  The type provider designer assembly 'AvroProvider.DesignTime.dll' could not be loaded from folder '/Users/alexey/src/test/AvroProvider/src/AvroProvider.DesignTime/bin/Debug/net6.0'. The exception reported was: System.IO.FileNotFoundException - Could not load file or assembly 'FSharp.TypeProviders.SDK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

There is no place in the project that references FSharp.TypeProviders.SDK 1.0.0.0, however AvroProvider/src/AvroProvider.DesignTime/bin/Debug/net6.0/AvroProvider.DesignTime.deps.json includes this statement:

      "FSharp.TypeProviders.SDK/7.0.3": {
        "dependencies": {
          "FSharp.Core": "6.0.5"
        },
        "runtime": {
          "lib/netstandard2.1/FSharp.TypeProviders.SDK.dll": {
            "assemblyVersion": "1.0.0.0",
            "fileVersion": "1.0.0.0"
          }
        }
      }
    }

I am not sure if it is a cause of a symptom of the problem.

image

Repro steps

  1. Clone this project: https://github.com/AlexeyRaga/FSharp.AvroProvider

  2. do dotnet build (I am building it on MacOS)

Expected behavior

The provider builds and is accessible in the test project

Actual behavior

  The type provider designer assembly 'AvroProvider.DesignTime.dll' could not be loaded from folder '/Users/alexey/src/test/AvroProvider/src/AvroProvider.DesignTime/bin/Debug/net6.0'. The exception reported was: System.IO.FileNotFoundException - Could not load file or assembly 'FSharp.TypeProviders.SDK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

Known workarounds

I wasn't able to find any

Related information

  • Operating system: Mac OS
  • Branch: NuGet, 7.0.3
  • .NET Version: 6.0.202

AlexeyRaga avatar Jun 26 '22 14:06 AlexeyRaga

That matches the version stamped on the DLL itself

image

but separately the version of that DLL should probably be fixed.

baronfel avatar Jun 26 '22 14:06 baronfel

Hmmm, you are right @baronfel! I haven't checked that assuming that the version is == to the package version and I now feel stupid :)

But if it is installed, do you have any idea of how to make it available?

I think (and it may again be an incorrect guess) that when the runtime package does

[<assembly:CompilerServices.TypeProviderAssembly("AvroProvider.DesignTime.dll")>]

it cannot see libraries that are installed with nuget. How do people normally workaround it?

AlexeyRaga avatar Jun 26 '22 23:06 AlexeyRaga

I took a look and noticed a few things

  1. The Runtime DLL should not reference the TPSDK https://github.com/AlexeyRaga/FSharp.AvroProvider/blob/52adec5c287e69fa129ce5f0c30643686a985c9b/src/AvroProvider.Runtime/AvroProvider.Runtime.fsproj#L16

  2. You need to make sure that the contents of the TPSDK end up in your package correctly

  3. A few other things were wwrong with the setup that the default template was providing

The fixes are here, they will also be in a PR to this repo https://github.com/AlexeyRaga/FSharp.AvroProvider/pull/1

dsyme avatar Aug 17 '22 16:08 dsyme