Skip to content

Environment Setup

Terminal window
# Check version
dotnet --version
# Expected output: 10.0.100
# Install (Windows)
winget install Microsoft.DotNet.SDK.10
# Install (macOS)
brew install --cask dotnet-sdk
# Install (Linux - Ubuntu)
sudo apt-get update && sudo apt-get install -y dotnet-sdk-10.0

Terminal window
# Create a new project
dotnet new console -n MyValueObjectProject
# Install the LanguageExt package
cd MyValueObjectProject
dotnet add package LanguageExt.Core

These are the basic using statements to use in your project:

using LanguageExt;
using LanguageExt.Common;
using static LanguageExt.Prelude;

You can manage using statements used throughout the project in a single place:

GlobalUsings.cs
global using LanguageExt;
global using LanguageExt.Common;
global using static LanguageExt.Prelude;

Terminal window
# Navigate to a specific project
cd Docs/tutorials/Functional-ValueObject/01-Concept/01-Basic-Divide/BasicDivide
# Run the project
dotnet run
Terminal window
# Navigate to the test project
cd Docs/tutorials/Functional-ValueObject/01-Concept/01-Basic-Divide/BasicDivide.Tests.Unit
# Run tests
dotnet test
Terminal window
# From the solution root
dotnet build
# Run all tests
dotnet test

Each tutorial project has the following structure:

01-Basic-Divide/
├── BasicDivide/ # Main project
│ ├── Program.cs # Main entry file
│ ├── MathOperations.cs # Core logic
│ ├── BasicDivide.csproj # Project file
│ └── README.md # Project description
└── BasicDivide.Tests.Unit/ # Test project
├── MathOperationsTests.cs # Test file
├── BasicDivide.Tests.Unit.csproj
└── README.md

If the environment setup is complete, try running the first example:

Terminal window
cd Docs/tutorials/Functional-ValueObject/01-Concept/01-Basic-Divide/BasicDivide
dotnet run
=== Basic Division Function ===
Normal case:
10 / 2 = 5
Exception case:
10 / 0 = System.DivideByZeroException: Attempted to divide by zero.

Terminal window
# Check the PATH environment variable
echo $PATH
# On Windows, add the following path to system environment variables
# C:\Program Files\dotnet
Terminal window
# Check NuGet sources
dotnet nuget list source
# Add the official NuGet source
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
  1. Restart the IDE
  2. Run dotnet restore
  3. Delete the .vs or .vscode folder and restart

Q1: Can I run this with a version other than .NET 10?

Section titled “Q1: Can I run this with a version other than .NET 10?”

A: The tutorial projects are written targeting .NET 10.0 SDK. Some code may work on earlier versions, but since there are parts that use .NET 10-specific features such as file-based program execution, .NET 10.0 or later is recommended.

A: No. It is optional. Declaring using LanguageExt; etc. directly in each file works the same way. It is convenient when you want to reduce repetitive using statements across the entire project.

Q3: Which version of the LanguageExt package should I install?

Section titled “Q3: Which version of the LanguageExt package should I install?”

A: Running dotnet add package LanguageExt.Core installs the latest stable version. Each tutorial project has a verified version specified in its .csproj file, so building the solution will automatically restore the correct version.


The environment setup is complete. Now in Part 1, you will directly observe the problems with a basic division function and take the first step toward evolving it into a value object.

Chapter 1: Starting with Basic Division