.NET
This guide covers setting up .NET development with the .NET SDK and NuGet.
Installation
We recommend .NET 8.0 SDK (Long Term Support).
- Windows
- macOS
- Linux
# Using winget
winget install Microsoft.DotNet.SDK.8
# Or using Chocolatey
choco install dotnet-8.0-sdk
Or download the installer from dotnet.microsoft.com/download.
# Using Homebrew
brew install --cask dotnet-sdk
Or download the installer from dotnet.microsoft.com/download.
# Ubuntu/Debian - Add Microsoft package signing key
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
# Install .NET SDK
sudo apt-get update
sudo apt-get install -y dotnet-sdk-8.0
Verify Installation
dotnet --version
dotnet --list-sdks
NuGet
NuGet is the package manager for .NET. It handles dependency management and is integrated into the .NET CLI.
Common dotnet Commands
# Create a new project
dotnet new webapi -n MyApi
# Restore packages
dotnet restore
# Build project
dotnet build
# Run project
dotnet run
# Run tests
dotnet test
# Add a package
dotnet add package Newtonsoft.Json
Set Up NuGet with JFrog
- Go to https://p6m.jfrog.io
- Login
- Navigate to Profile → Set Me Up → NuGet
- Click Generate Token and Create Instructions
- Follow the instructions to add the NuGet source:
dotnet nuget add source "https://p6m.jfrog.io/artifactory/api/nuget/v3/nuget" \
--name "p6m" \
--username "your-username" \
--password "your-token"
Related
- Microsoft .NET Documentation - Official .NET documentation
- NuGet Configuration - Configure NuGet feeds