- Reference: Youtube: Getting Started with .NET Core using F#
- Uses Kestrel web server
- Install .net core.
- Install a editor. Preferably VS Code
- If using VS Code, extensions following packages:
- Ionide-fsharp
- C#
- [Optional] Vim (for vim users), vscode-icons (fancy icons)
- If using VS Code, extensions following packages:
- Restore packages -
dotnet restore
- Build project -
dotnet build
- Launch webserver -
cd CoreFSharp.Web; dotnet run
- Create the top level project directory. We will use CoreFSharp directory for it. It should be same as project name.
mkdir CoreFSharp
cd CoreFSharp
- Create solution File:
dotnet new sln
- Create a mvc subproject:
- Create the sub-directory first:
mkdir CoreFSharp.Web; cd CoreFSharp.Web
- Initialize sub-project:
dotnet new mvc -lang f#
- Create the sub-directory first:
- Reference subproject in solution file:
dotnet sln add ./CoreFSharp.Web/CoreFSharp.Web.fsproj
- Verify it by calling
dotnet sln list
- Rebuild project:
dotnet restore; dotnet build
- Verify it by calling
- Create a library sub-project:
- Create the sub-directory first:
mkdir CoreFSharp.Library; cd CoreFSharp.Library
- Initialize sub-project:
dotnet new classlib -lang f#
- Create the sub-directory first:
- Reference subproject in solution file:
dotnet sln add ./CoreFSharp.Library/CoreFSharp.Library.fsproj
- Verify it by calling
dotnet sln list
- Rebuild project:
dotnet restore; dotnet build
- Verify it by calling
- Adding subproject dependancy: Add new ItemGroup in CoreFSharp/CoreFSharp.Web.fsproj.
<ItemGroup> <ProjectReference Include="../CoreFSharp.Library/CoreFSharp.Library.fsproj" /> </ItemGroup>
- Restore, Rebuild:
dotnet restore; dotnet build
- Launch web server w/o Debugger:
cd CoreFSharp.Web; dotnet run
. Note You should launch it from the mvc sub-project.
- Launch web server /w Debugger:
In VsCode, start debug session with .NET Core Launch (web) (or just press
F5
).- Note: Make sure to set current working directory (
cwd
in .vscode/launch.json to web sub-project
- Note: Make sure to set current working directory (
- To check .net core version:
dotnet --version
- List subprojects referenced in solution file (execute it from project root directory):
dotnet sln list
- Files to be considered in .gitignore: */bin, */obj, *.swp