10
votes

I can't seem to figure out how to get F# TypeProviders to work in a Windows Store (C#) app.

As far as I can tell, TypeProviders can only be used in an assembly targeting the full .NET Framework, whereas Windows Store apps must target .NET Portable.

I have created an F# assembly and referenced the F# TypeProviders library, however when attempting to reference this assembly from my Windows Store app, I receive an error stating that the library could not be referenced.

Is there any way around this? I want to use F# TypeProviders to reference various data sources and then use the generated code/types in my Windows Store app. Anyone have experience with this?

UPDATE:

Just to be clear, I am asking if there is a way to use the standard F# TypeProviders (such as WsdlService) in a Windows Store App?

2
It unclear to me whether your question is "is it possible to create a type provider that can be used to write Windows Store Apps?" or "can the type providers in the F# standard library be used to write Windows Store Apps?". The answers are "yes" and "no", respectively.kvb
Thank you for your comment and responses, I have clarified my question.Joshua

2 Answers

3
votes

Looking at the other assemblies FSharp.Data.TypeProviders.dll is referencing, I don't think there is a way around this. Since most type providers are used for accessing a database in one way or another (ADO.NET, LINQ to SQL, EF), it references System.Data.dll which is not available in WinRT.

The only data sources supported by built-in type providers that can be used in WinRT are web services and OData services. Their type providers maybe could be supported in a WinRT project if they were implemented in a separate library, but not in their current implementation.

2
votes

Type providers are design/compile time facility. It should work in Portable library profile. It is maybe dependent on how is type provider library implemented, but in general, it should work.

For more info see F# type providers with Portable Library