Environment Setup
Required Prerequisites
Section titled “Required Prerequisites”1. .NET 10.0 SDK
Section titled “1. .NET 10.0 SDK”# Check versiondotnet --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.02. IDE Setup
Section titled “2. IDE Setup”VS Code + C# Dev Kit
Section titled “VS Code + C# Dev Kit”- Install the C# Dev Kit extension
Project Setup
Section titled “Project Setup”Create a New Project
Section titled “Create a New Project”# Create a new projectdotnet new console -n MyValueObjectProject
# Install the LanguageExt packagecd MyValueObjectProjectdotnet add package LanguageExt.CoreBasic using Statements
Section titled “Basic using Statements”These are the basic using statements to use in your project:
using LanguageExt;using LanguageExt.Common;using static LanguageExt.Prelude;GlobalUsings.cs (Optional)
Section titled “GlobalUsings.cs (Optional)”You can manage using statements used throughout the project in a single place:
global using LanguageExt;global using LanguageExt.Common;global using static LanguageExt.Prelude;Running Each Project
Section titled “Running Each Project”Run a Project
Section titled “Run a Project”# Navigate to a specific projectcd Docs/tutorials/Functional-ValueObject/01-Concept/01-Basic-Divide/BasicDivide
# Run the projectdotnet runRun Tests
Section titled “Run Tests”# Navigate to the test projectcd Docs/tutorials/Functional-ValueObject/01-Concept/01-Basic-Divide/BasicDivide.Tests.Unit
# Run testsdotnet testBuild the Entire Solution
Section titled “Build the Entire Solution”# From the solution rootdotnet build
# Run all testsdotnet testProject Structure
Section titled “Project Structure”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.mdRunning the First Example
Section titled “Running the First Example”If the environment setup is complete, try running the first example:
cd Docs/tutorials/Functional-ValueObject/01-Concept/01-Basic-Divide/BasicDividedotnet runExpected Output
Section titled “Expected Output”=== Basic Division Function ===
Normal case:10 / 2 = 5
Exception case:10 / 0 = System.DivideByZeroException: Attempted to divide by zero.Troubleshooting
Section titled “Troubleshooting”If the .NET SDK Is Not Recognized
Section titled “If the .NET SDK Is Not Recognized”# Check the PATH environment variableecho $PATH
# On Windows, add the following path to system environment variables# C:\Program Files\dotnetLanguageExt Package Installation Failure
Section titled “LanguageExt Package Installation Failure”# Check NuGet sourcesdotnet nuget list source
# Add the official NuGet sourcedotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.orgIntelliSense Not Working in the IDE
Section titled “IntelliSense Not Working in the IDE”- Restart the IDE
- Run
dotnet restore - Delete the
.vsor.vscodefolder 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.
Q2: Do I have to create GlobalUsings.cs?
Section titled “Q2: Do I have to create GlobalUsings.cs?”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.
Next Steps
Section titled “Next Steps”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.