I need to find a way of building rest services in F# using the latest asp.net 5 and mvc 6 web api. Is there any direct support for this in Visual Studio 2015 as a project template? If not, could someone please put me on the right track on how to proceed? One option could be to build an F# library and then call it from a C# asp.net mvc 6 project. However I would be very interested in building a native F# mvc 6 web api. Thanks!
Google returned the following project: https://github.com/fsprojects/fsharp-dnx
The HelloFSharp sample works fine, however could not manage to make the HelloMVC project build:
dnx web has the following error:
System.TypeLoadException: Could not load type 'Microsoft.Extensions.Logging.ILogValues' from assembly 'Microsoft.Extensions.Logging.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
F# is now supported by .net core. As of this writing, F# code can only be compiled with .net core 1.0.3 LTS. On Ubuntu 16.10, use the steps described here to add the .net core repo.
sudo apt-get install dotnet-dev-1.0.0-preview2-003156
mkdir helloworldfsharp
and cd helloworldfsharp
dotnet new -l f#
. This will create a new F# project dotnet restore
. This will restore all packages and install the F# compiler.dotnet build
dotnet run
Edit: The previous steps generates a console application. If you want to create a asp.net core mvc app, adapt the generated files as described here (as you see in the link, this is quite straightforward).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With