F# abandoned on .NET Framework?

I’m currently researching using F# for projects at work. We’ve gone down the path of adopting Elixir in areas where we can but have integrations with legacy .NET/Windows – and like the idea of using F# over C# for these projects because of the similar mental models between F# and Elixir. Saturn is also explicitly developed with Elixir/Phoenix in mind, so it seems like we’re not alone in this thought.

The resources for F# on .NET core look great. If we were building a .NET core web api, I’d be looking at Giraffe and Saturn and probably choosing the latter and already be on my way to developing our new products.

However, when I look for F# on the web for .NET Framework I see almost nothing, with the few things that do exist archived on Github or not updated or talked about since 2014 or even earlier. My sense is that the F# community is so small that they had to choose one or the other and have intelligently put all their eggs in the .NET core basket – which unfortunately leaves us with C# as the only real choice for building a web api that targets .NET Framework.

Am I wrong? I really want to be. If so could someone please correct me and point me to some up to date resources?

C# and F# both run on the .NET Framework, although Microsoft are moving to .NET Core, and then to one .NET with .NET 5.0.

If you need to use use .NET Framework, there’s still ASP.NET MVC, you can write the controllers in F# at a push but it might not be straight forward. Some developers have the controllers and MVC code in C# and interoping with F# code for the backend.

YMMV, depending on the types of API’s you are building, simple CRUD operations on a database may be easier to keep in one language, but if you have lots of complex domain logic, having the C# controllers reference an F# project that does the hard work, you may see benefits.

Most of the community seems to be abandoning .NET Framework along with Microsoft, so you will probably find less and less new things that work on it. Microsoft are even getting WinForms working on .NET Core!

You may also find you have to stick with an older version of the F# language and core libraries as newer features depend purely on .NET Core features - e.g. Span / Memory. But the same is true of C#.

HTH,
Dave

Thanks for the reply! Is there a template out there for F#? On VS 2019 I can choose C# ASP.NET (.NET Framework). The only option for F# is .NET core. I don’t see any examples out there even remotely up to date for F# on .NET Framework so I’m not sure how to even start a project.

The actual web api is pretty basic so I’m not concerned with having the most up to date F# or .NET features.

There don’t appear to be any templates, but if you want to build a project manually…

Mark Seamann has a number of articles where he’s done just that:

There might be more I only did a quick google for them :slight_smile:

Yeah I had seen those – as I said I’m not super comfortable setting out to build something with instructions from 2013, let alone having the confidence to launch it in production. I would reasonably expect to get pretty far before finding out I can’t do some simple thing and having no choice but to rewrite in C#.

Thanks again for the speedy responses.

.NET Framework is “done”. It gets security updates and is supported forever, but no new features are being added to it and no new capabilities are being built for it. I would highly recommend not using it for anything new if you can.

All of this is to say, there’s not a terrible amount of motivation to ensure F# + Web works well for .NET Framework. The .NET world is moving to .NET Core, especially for web and cloud scenarios. That’s why there is a lot of focus for F# to work well there.

Yeah. I’ve actually been a .NET/C# lead for a decade so I’m well aware that the future of .NET is Core.

Up until this year I was a consultant for mid-large enterprises. And forums like this might make claims like that, but it wasn’t until LAST YEAR I was put on my first .NET core project. Companies didn’t get that message.

The support for C# on .NET Framework is still there. If you google ASP.NET .NET Framework you’ll get blogs and online courses created or updated THIS YEAR, not 2013. The situation is hardly comparable.

As I said, I understand the F# community is about 1% the size as C# so can’t afford resources to maintain support on legacy platforms like C# can – but I just wanted to verify that before abandoning all hope.