Search code examples
f#type-providersf#-data

Embed the sample files of F# JsonProvider to use in a library


According to this, you can specify samples as embedded resources by using EmbeddedResource:

type Declaracion = JsonProvider<"declaracion.json", EmbeddedResource="Irpf.Hechos, declaracion.json">

But when I reference this library, "Irpf.Hechos.dll", I get a File Not Found error, the path ConsumingLibraryPath\declaracion.json is not found; typecheck error FS3033

I have tried to set the declaracion.json file as resource, and content, but no luck.

Am I missing some step?


Solution

  • You need to set the build action as "EmbeddedResource" rather than "Resource".