-
Notifications
You must be signed in to change notification settings - Fork 7
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
Enabling "portable" profiles in projects #10
Comments
This table can be used to record the current state of which "fsprojects" libraries are PCL. However in many cases moving to .NET Core will not be immediately possible due to non-portability or dependencies. Libraries:✅ FSharp.Core.Fluent
Other Libraries (not in fsprojects, mentioned in the comments thread):✅ Unquote Tools in fsprojects (needs case-by-case consideration about if/how to make portable or .NET Core friendly)
Intrinsically Non-PCL and/or non-cross-platform💥 FSharp.Compiler.CodeDom Type providers (not yet possible to make these portable)
Dormant projects
|
Here are the approximate steps to add a PCL Portable build of an otherwise unremarkable F# library called The aim is to make a nuget package containing both your existing .NET 4.x DLL and a portable DLL containing essentially the same functionality.
1 - Create directory 2 - Edit the portable project file to contain these magic lines, replacing corresponding existing lines
Also change the file-references in the project file to be links referring across a directory, e.g. like this, e.g.
becomes
3 - Add the portable project to the solution, either using IDE tooling or like this 4 - Build your project. If it doesn't build then your project may not be portable. Or you may need to use "reshaped reflection" if your project uses reflection, for example these helpers taken from FSharp.Core. There may be a better version of these helpers around for you to use. 5 - If you're game, try adjusting to Profile78 or Profile259. These are "even more portable" profiles, and may be necessary if you want your project consumable by most Xamarin tooling. The
6 - Add the portable outputs to the nuget package using the correct moniker, like this if using nuget.exe and like this if using paket.exe. The monikers to use in the subdirectory in the nuget packages are
7 - Check your nuget package. Try using it from a new F# portable profile 7 library (which should be able to refer to either profile 78 or profile 259 libraries too) 8 - Push your new nuget package Note that it may be possible (and much nicer) to remove the .NET 4.x version of your package after you've made your PCL package. However test that path carefully and ensure that your portable version doesn't contain any less functionality |
Don't forget fparsec. I think it is already converted to PCL. Though again without .NET native support we won't be able to run them as UWP apps :( |
@Reverseblade This thread only deals with "fsprojects" projects. It would be great to make a more complete table, e.g. of everything under http://fsharp.org/community/projects. Also of the major C# libraries that F# community work sits on (e.g. Math.NET Numerics). |
FParsec already is, although I have to admit I'm struggling to understand the relationships between NuGet monikers, profiles, etc. I've followed The Don Guide in sentiment rather than exactly, and ended up with Profile259 assemblies, although it is fiddly, and i'm not looking forward to trying this with a large many project codebase (Freya). |
I do have a PR for FSharp.Control.Reactive that makes it Profile259. It needs a second pair of eyes. fsprojects/FSharp.Control.Reactive#65 |
Here's the background research that I did on this topic, to save anyone else the effort:
|
FYI - Unquote has builds targeting .NET 4.0, .NET 4.5, and Portable Profile 259. |
@stephen-swensen Great! |
How do PCLs interact w/ .Net Core/CoreCLR? |
THis is non-authoritative, but basically the important thing is
So making something into a PCL 259/78/7 means it can be referenced from a .NET Standard library, and can be sued on both .NET Core and ,NET Framework. Likewise making something into a .NET Standard library means it can be used on both .NET Core and ,NET Framework. That's not authoritative, just my understanding of how things work. Eventually I'd expect most F# libraries to just be .NET Standard 1.something. |
I believe currently the most 'ideal' profile is profile 151 at the moment. |
Why can't the compiler handle this complexity? It could make it the 'most compatible' by default? |
@haf The F# compiler (fsc.ex) doesn't really change much, the caller just points the compiler at different sets of reference binaries. The complexity and churn here is unfortunate and really a question for the .NET designers. They've iterated on this multiple times, only recently settling on .NET Standard as the way of binary code sharing - and there will be another iteration on that. |
@dsyme That's what I mean; can't the compiler than know about those sets without heavy-handed xml generated by opaque tooling. I'd like to specify a single input the to the compiler; e.g. a list of target "profiles": |
@haf the tooling just resolve the path of assemblies (from gac or packages). now all references are passed as normal file references, no more magic. there is a switch for For example the response file of the compiler (the arguments) to build
running but for netstandard the list of referenced assemblies change too.. so something (the tooling) should choose. be that The idea is netstandard is an upgraded version of pcl, so no more intersection of api (115, 259, etc), but an incremental api surface ( |
We should gradually make more "fsprojects" and other F# community libraries available as portable libraries (profile 7, 78 or 259). Portable libraries are consumable by both .NET Core and .NET Framework projects, as well as Windows apps and so on. Looking ahead it seems pretty important that we maximize the reach of F# libraries where possible. This will be a fairly long process but it will be worth it.
For example, we made FSharp.Control.AsyncSeq available as both a .NET 4.5 and Profile7 PCL in this PR. We could have made it only a Profile7 but decided to do both for the moment.
The text was updated successfully, but these errors were encountered: