Skip to main content

.NET Development Setup

Complete setup guide for .NET development covering .NET SDK, tooling, IDE configuration, and modern development workflows.

Overview

.NET is Microsoft's free, cross-platform, open-source developer platform for building many different types of applications. This guide covers setting up a professional .NET development environment with the latest SDK, essential tools, and development best practices.

Prerequisites

Before starting, ensure you have:

  • System Access: Administrative privileges for installing software
  • Internet Connection: For downloading packages and NuGet packages
  • Terminal/Command Prompt: For running .NET CLI commands
  • Source Control: Git configured (see Source Control Setup)
  • RAM: 8GB minimum, 16GB recommended for large solutions
  • Storage: 5GB+ free space for .NET SDK and dependencies
  • OS: Windows 10+, macOS 10.15+, or Linux (Ubuntu 18.04+)

Required Company Setup

Installation Options

Download and Install

  1. Visit https://dotnet.microsoft.com/download
  2. Download .NET 8.0 SDK (Long Term Support)
  3. Run the installer for your platform

Platform-Specific Installation

Windows
# Using winget
winget install Microsoft.DotNet.SDK.8

# Using Chocolatey
choco install dotnet-8.0-sdk

# Verify installation
dotnet --version
dotnet --list-sdks
macOS
# Using Homebrew
brew install --cask dotnet-sdk

# Or download installer from Microsoft
# https://dotnet.microsoft.com/download/dotnet/8.0

# Verify installation
dotnet --version
dotnet --list-sdks
Linux (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

Option 2: Multiple Version Management

Use .NET SDK's built-in global.json for version pinning:

{
"sdk": {
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
Terminal Restart Required

After installation, restart your terminal or open a new tab so it recognizes the dotnet command.

Essential Tools & Package Management

1. .NET CLI Tools

# Install essential global tools
dotnet tool install -g dotnet-ef # Entity Framework Core tools
dotnet tool install -g dotnet-aspnet-codegenerator # ASP.NET Core scaffolding
dotnet tool install -g dotnet-outdated # Check for outdated packages
dotnet tool install -g dotnet-format # Code formatting (legacy)
dotnet tool install -g Microsoft.Web.LibraryManager.Cli # Library Manager (libman)

# Verify installation
dotnet tool list -g

2. Package Sources Configuration

# List current package sources
dotnet nuget list source

# Add company NuGet source (replace with your company feed)
dotnet nuget add source "https://your-company.pkgs.visualstudio.com/_packaging/feed/nuget/v3/index.json" \
--name "CompanyFeed" \
--username "your-username" \
--password "your-pat-token" \
--store-password-in-clear-text

# Trust company certificates (if using private feeds)
dotnet nuget trust source "CompanyFeed"

3. Entity Framework Core Setup

Entity Framework Core is the recommended ORM for .NET:

# Install EF Core tools globally
dotnet tool install --global dotnet-ef

# Verify EF tools installation
dotnet ef --version

# In your project, install EF Core packages
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package Microsoft.EntityFrameworkCore.Tools

Development Environment & IDE Setup

Visual Studio 2022 Community/Professional

# Download from: https://visualstudio.microsoft.com/downloads/
# Select workloads during installation:
# - ASP.NET and web development
# - .NET desktop development
# - Azure development (if using Azure)

Essential Extensions

  • Web Essentials: Enhanced web development
  • GitHub Extension: Integrated source control
  • ReSharper (optional): Advanced code analysis
  • Live Share: Real-time collaboration

Visual Studio Code (Cross-Platform Alternative)

# Install VS Code extensions
code --install-extension ms-dotnettools.csharp
code --install-extension ms-dotnettools.dotnet-interactive-vscode
code --install-extension ms-dotnettools.vscode-dotnet-runtime
code --install-extension formulahendry.dotnet-test-explorer
code --install-extension jchannon.csharpextensions
code --install-extension k--kato.docomment

VS Code Settings for .NET

Create .vscode/settings.json:

{
"dotnet.enablePackageRestore": true,
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true,
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.enableEditorConfigSupport": true,
"files.exclude": {
"**/bin": true,
"**/obj": true
}
}

JetBrains Rider (Professional Option)

  • Full-featured IDE with excellent .NET support
  • Built-in debugger, profiler, and unit test runner
  • Advanced refactoring and code analysis

Project Structure & Configuration

Typical Solution Structure

MySolution/
├── src/
│ ├── MyApp.Api/ # Web API project
│ ├── MyApp.Core/ # Business logic/domain
│ ├── MyApp.Infrastructure/ # Data access/external services
│ └── MyApp.Shared/ # Shared DTOs/contracts
├── tests/
│ ├── MyApp.UnitTests/
│ ├── MyApp.IntegrationTests/
│ └── MyApp.Api.Tests/
├── docs/
├── .gitignore
├── .editorconfig
├── Directory.Build.props
├── global.json
├── MySolution.sln
└── README.md

Essential Configuration Files

Directory.Build.props (Solution-level settings)

<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<WarningsNotAsErrors>nullable</WarningsNotAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" PrivateAssets="all" />
</ItemGroup>
</Project>

.editorconfig (Code style)

root = true

[*]
charset = utf-8
end_of_line = crlf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{cs,csx,vb,vbx}]
indent_size = 4

[*.{json,js,yml,yaml}]
indent_size = 2

Common Workflows

Project Creation

# Create new solution
dotnet new sln -n MySolution

# Create projects
dotnet new webapi -n MySolution.Api
dotnet new classlib -n MySolution.Core
dotnet new xunit -n MySolution.Tests

# Add projects to solution
dotnet sln add MySolution.Api/MySolution.Api.csproj
dotnet sln add MySolution.Core/MySolution.Core.csproj
dotnet sln add MySolution.Tests/MySolution.Tests.csproj

# Add project references
dotnet add MySolution.Api/MySolution.Api.csproj reference MySolution.Core/MySolution.Core.csproj
dotnet add MySolution.Tests/MySolution.Tests.csproj reference MySolution.Core/MySolution.Core.csproj

Development Workflow

# Restore packages
dotnet restore

# Build solution
dotnet build

# Run application
dotnet run --project MySolution.Api

# Run with hot reload
dotnet watch run --project MySolution.Api

# Run tests
dotnet test

# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"

Package Management

# Add NuGet package
dotnet add package Newtonsoft.Json

# Add specific version
dotnet add package Serilog --version 3.1.1

# Remove package
dotnet remove package Newtonsoft.Json

# List packages
dotnet list package

# Check for outdated packages
dotnet outdated

# Update packages
dotnet add package PackageName --version latest

Platform Considerations

Windows

  • Full Visual Studio IDE support
  • Windows-specific APIs and frameworks available
  • Best integration with Azure services
  • Windows Forms and WPF for desktop applications

macOS

  • Visual Studio for Mac or VS Code
  • Limited to web and console applications
  • Docker containers for Windows-specific dependencies
  • Excellent for cross-platform development

Linux

  • VS Code or JetBrains Rider
  • Great performance for web applications
  • Container-first development workflows
  • Production deployment target

Environment Verification

Basic Verification

# Check .NET installation
dotnet --version
dotnet --info
dotnet --list-sdks
dotnet --list-runtimes

# Check global tools
dotnet tool list -g

# Test project creation
mkdir test-app && cd test-app
dotnet new console
dotnet run

Advanced Verification

# Create and test web API
dotnet new webapi -n TestApi
cd TestApi
dotnet run

# In another terminal, test the API
curl https://localhost:7000/weatherforecast

Troubleshooting

Common Issues

.NET SDK Not Found

# Check PATH environment variable
echo $PATH # macOS/Linux
echo $env:PATH # Windows PowerShell

# Manually add to PATH if needed (macOS/Linux)
export PATH="$PATH:/usr/local/share/dotnet"

# Manually add to PATH (Windows)
$env:PATH += ";C:\Program Files\dotnet"

Package Restore Failures

# Clear NuGet caches
dotnet nuget locals all --clear

# Restore with verbose output
dotnet restore --verbosity detailed

# Check package sources
dotnet nuget list source

Build Errors

# Clean and rebuild
dotnet clean
dotnet build --verbosity detailed

# Check for conflicting packages
dotnet list package --include-transitive

Authentication Issues with Private Feeds

# Add credentials to package source
dotnet nuget add source "https://your-feed" \
--name "YourFeed" \
--username "username" \
--password "token"

# Or use credential providers
dotnet tool install -g Microsoft.VisualStudio.Services.Nuget.CredentialProvider

Performance Issues

Slow Build Times

# Use parallel builds
dotnet build --verbosity minimal -m

# Disable unnecessary analyzers temporarily
<PropertyGroup>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
</PropertyGroup>

Memory Issues

# Increase heap size for MSBuild
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export MSBUILD_EXE_PATH="/usr/local/share/dotnet/sdk/current/MSBuild.dll"

Integration & Next Steps

Company-Specific Integration

  1. Private NuGet Feeds: Configure access to company packages
  2. Code Analysis: Set up company coding standards and analyzers
  3. CI/CD: Integrate with company build pipelines
  4. Monitoring: Configure application insights and logging
  1. C# Fundamentals: Master language features and syntax
  2. ASP.NET Core: Build web APIs and applications
  3. Entity Framework Core: Learn data access patterns
  4. Testing: Unit testing with xUnit and integration testing
  5. Deployment: Container deployment and Azure hosting
# Web API with controllers
dotnet new webapi -n MyApi

# Minimal API
dotnet new web -n MyMinimalApi

# Blazor Server
dotnet new blazorserver -n MyBlazorApp

# Console application
dotnet new console -n MyConsoleApp

# Class library
dotnet new classlib -n MyLibrary

# xUnit test project
dotnet new xunit -n MyTests

Next: Start building your first .NET application!