fsprojects / FSharp.TypeProviders.SDK

The SDK for creating F# type providers
https://fsprojects.github.io/FSharp.TypeProviders.SDK/
MIT License
298 stars 94 forks source link

Typeprovider works in IDE but test project compile fails with 'assembly not found' #396

Closed fwaris closed 8 months ago

fwaris commented 8 months ago

Description

I generated a typeprovider using the dotnet template. It was working fine until the 3rd party libraries were 'revved'. Now, the typeprovider works in the test project in the IDE but the test project itself does not compile with dotnet build:

C:\Users\fwaris1\source\repos\SKProvider\tests\SKProvider.Tests\SKProvider.Tests.fs(25,11): error FS3033: The type provider 'SKProviderImplementation+SKTypeProvider' reported
 an error: Could not load file or assembly 'Microsoft.SemanticKernel.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3'. The system cannot find 
the file specified. 

I have attached the output of "dotnet build -v d > out.txt".

I can see that the fsc command line args look fine. It seems when the typeprovider code tries to generate the types, it cannot find the assemblies that it needs at build time. (I don't think that the exact assembly it cannot find, matters here.)

Please provide the steps required to reproduce the problem

  1. Clone repo https://github.com/fwaris/SKProvider

  2. Set environment variable SK_SAMPLES_HOME to [your project root]/tests\SKProvider.Tests\skills. The typeprovider 'test' project loads files from here for the provided types.

  3. Perform the usual build: -- dotnet tool restore -- dotnet paket update -- dotnet build

fwaris commented 8 months ago

cannot attach build output for some reason

fwaris commented 8 months ago

Was able to get around this specific issue - mostly by studying other typeprovider codes. (Now need to brush up on F# metaprogramming!)