Closed Happypig375 closed 2 years ago
totally agree also paket seems not supported as an extension on VS2019 currently. https://github.com/fsprojects/Paket.VisualStudio/issues/176 this makes the dev experience not so friendly
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#
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
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)
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?
@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?
@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.
FWIW the repo is now set up to be able to publish the TPSDK as a standalone package (at least with https://github.com/fsprojects/FSharp.TypeProviders.SDK/pull/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: https://github.com/fsprojects/FSharp.TypeProviders.SDK/pull/339#issuecomment-716906435
@cartermp do we still need to pack all transitive dependencies of design-time component inside TP nuget package in the folder near DT assembly?
I would expect so, yeah
@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.
Closing this old discussion
@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 https://github.com/mettekou/FSharp.Data.Tdms/issues/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?
@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.
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.