Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSharp.TypeProviders.SDK nuget package usage is not simple and not documented #383

Closed
AlexeyRaga opened this issue Jun 26, 2022 · 3 comments
Labels

Comments

@AlexeyRaga
Copy link

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
@baronfel
Copy link
Contributor

That matches the version stamped on the DLL itself

image

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

@AlexeyRaga
Copy link
Author

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?

@dsyme dsyme added the bug label Aug 17, 2022
@dsyme
Copy link
Contributor

dsyme commented Aug 17, 2022

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 AlexeyRaga/FSharp.AvroProvider#1

@dsyme dsyme changed the title Wrong version of FSharp.TypeProviders.SDK is required when using a nuget package FSharp.TypeProviders.SDK nuget package usage is not simple and not documented Aug 17, 2022
@dsyme dsyme closed this as completed Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants