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

Cannot create a type provider without Paket? #314

Closed
Happypig375 opened this issue Jun 12, 2019 · 13 comments
Closed

Cannot create a type provider without Paket? #314

Happypig375 opened this issue Jun 12, 2019 · 13 comments

Comments

@Happypig375
Copy link
Contributor

So there's this package: https://www.nuget.org/packages/FSharp.TypeProviders.StarterPack but it's been unlisted. Currently, there seems to be no way to create type providers by only using NuGet and not Paket. Why? Type Providers are a F# feature but seems that so much additional components are needed before it can be used.

@jkone27
Copy link

jkone27 commented Apr 13, 2020

totally agree also paket seems not supported as an extension on VS2019 currently. fsprojects/Paket.VisualStudio#176
this makes the dev experience not so friendly

@sergey-tihon
Copy link
Member

If you do not want to use Paket, you can manually copy 2 files from this repo to your TP project: ProvidedTypes.fs and ProvidedTypes.fsi

or even better, create solution from the template

dotnet new -i FSharp.TypeProviders.Templates
dotnet new typeprovider -n LemonadeProvider -lang F#

@jkone27
Copy link

jkone27 commented Apr 13, 2020

Yes that's what i also did to fix manually yes (adding the 2 files manually), indeed.
Though when i create the solution with the template, the fsi and fs files are missing apparently... at least in VS

image

i believe because also these 2 files are referenced by paket

File:ProvidedTypes.fsi
File:ProvidedTypes.fs

FSharp.Core
# put any package references here
# System.Text.Encoding.CodePages framework: netstandard2.0,netcoreapp3.1

i also don't have them in the project folders (projects where generated via template)

@sergey-tihon
Copy link
Member

it should work for sure if you build it from command line

dotnet tool restore
dotnet paket update
dotnet build -c release

what happens when you just build from VS? VS does not restore dotnel tool?

@mettekou
Copy link

@sergey-tihon Is there no way to create a type provider without using Paket or the template (which also uses Paket)? Is copying ProvidedTypes.fs and ProvidedTypes.fsi into an F# class library project representing the design-time really enough? This does not set up the NuGet package properly, i.e. the type provider does not end up in the NuGet package for the run-time project. How do I manually create the proper .nuspec file?

@sergey-tihon
Copy link
Member

@mettekou sorry, no idea. I never tried to do it with .nuspec file, because I relay like the granular control and freedom of packaging with paket.tempate.

You may start from solution created by template, replace .fsi & .fs file references by actual file and then try to hack .nuspec file produce the same folder layout that paket.template do.

Keep in mind that latest template still support both framework, but current master already moved to .NET Standard exclusively. There is a chance that latest SDK is able to pack TP correctly without Paket, but I do not have a sample to share you.

@cartermp
Copy link
Contributor

FWIW the repo is now set up to be able to publish the TPSDK as a standalone package (at least with #339), making paket no longer necessary for any sane creation and maintenance of a custom type provider.

As per @dsyme's comment it appears we just have to follow through: #339 (comment)

@sergey-tihon
Copy link
Member

@cartermp do we still need to pack all transitive dependencies of design-time component inside TP nuget package in the folder near DT assembly?

@cartermp
Copy link
Contributor

cartermp commented Jan 7, 2021

I would expect so, yeah

@mettekou
Copy link

mettekou commented Jan 15, 2021

@sergey-tihon I got my own type provider working without Paket using the following .nuspec file. Copying the design-time libraries to fsharp41/typeproviders/net50 doesn't work, but copying them to lib/net50 like the run-time libraries does.

@dsyme
Copy link
Contributor

dsyme commented Sep 21, 2021

Closing this old discussion

@dsyme dsyme closed this as completed Sep 21, 2021
@mettekou
Copy link

mettekou commented Jan 3, 2022

@dsyme As this discussion is closed, I assume it is now possible to create a type provider without Paket. However, I am struggling to do so for .NET 6, as per mettekou/FSharp.Data.Tdms#9. Adding the design-time assembly to the typeproviders/fsharp41/net6.0 directory within the NuGet package breaks the build for my type provider in Visual Studio 2022, but not the build using the .NET 6 SDK (dotnet build). Alternatively, adding the design-time assembly to the lib/net6.0 directory within the NuGet package breaks the build using the .NET 6 SDK, but the build in Visual Studio 2022 works. Is there an example of a type provider targetting .NET 6 without using Paket?

@cartermp
Copy link
Contributor

cartermp commented Jan 3, 2022

@mettekou I suspect the issue lies either in the F# compiler used for the .NET SDK or the F# compiler used in Visual Studio (they are different), and is unrelated to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants