GithubHelp home page GithubHelp logo

fsharplinuxquickstart's Introduction

Create a Simple F# Application in Linux

Setup Project

  1. Install Dotnet

  2. Check the Install

dotnet --version
  1. Create the Solution
dotnet new sln --name FSharpQuickStart
  1. 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
  1. Create a Test Project
dotnet new nunit -lang "F#" -o tests/FSharpQuickStart.Tests
  1. Add Projects to the Solution
dotnet sln add src/FSharpQuickStart.Console
dotnet sln add tests/FSharpQuickStart.Tests
  1. Add a Reference to the Console Project to Test Project
dotnet add tests/FSharpQuickStart.Tests reference src/FSharpQuickStart.Console

Add/Remove Files From Projects

  1. Add/Remove the .fs File in your Project Folder

  2. 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>

Running the Solution

  • Run Console Project
dotnet run --project src/FSharpQuickStart.Console/
  • Run Tests
dotnet test

Adding a Nuget Package

  1. Search for Nuget at the here

  2. Add Nuget Package to a Project ()

dotnet add src/FSharpQuickStart.Console package <Package Name>

fsharplinuxquickstart's People

Contributors

jfkonecn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.