-
Check the Install
dotnet --version
- Create the Solution
dotnet new sln --name FSharpQuickStart
- Create a Console Project
dotnet new console -lang "F#" -o src/FSharpQuickStart.Console
You can also search for templates
# Display Locally Available Templates
dotnet new --list
# Search Online
dotnet new <Search Text> --search
- Create a Test Project
dotnet new nunit -lang "F#" -o tests/FSharpQuickStart.Tests
- Add Projects to the Solution
dotnet sln add src/FSharpQuickStart.Console
dotnet sln add tests/FSharpQuickStart.Tests
- Add a Reference to the Console Project to Test Project
dotnet add tests/FSharpQuickStart.Tests reference src/FSharpQuickStart.Console
-
Add/Remove the .fs File in your Project Folder
-
Add/Remove the File Reference in the Project File
This is an example from the Test Project
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<ItemGroup>
<!-- NOTE THE FSHARP COMPILER WILL LOOK AT THESE FILES IN ORDER -->
<!-- FOR EXAMPLE IF YOU HAVE A FUNCTION FROM UnitTest1.fs USED IN Program.fs -->
<!-- THEN Program.fs MUST COME AFTER LIKE SO -->
<Compile Include="UnitTest1.fs" />
<Compile Include="Program.fs" />
<!-- To Add MyFile.fs -->
<Compile Include="MyFile.fs" />
<!-- To Remove the complie tags with files you want to delete -->
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="coverlet.collector" Version="3.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\FSharpQuickStart.Console\FSharpQuickStart.Console.fsproj" />
</ItemGroup>
</Project>
- Run Console Project
dotnet run --project src/FSharpQuickStart.Console/
- Run Tests
dotnet test
-
Search for Nuget at the here
-
Add Nuget Package to a Project ()
dotnet add src/FSharpQuickStart.Console package <Package Name>