![ASP.NET Core Pro Setup Guide Part 2 - Visual Studio, CLI, Extensions & Workflow Optimization | FreeLearning365 ASP.NET Core Pro Setup Guide Part 2 - Visual Studio, CLI, Extensions & Workflow Optimization | FreeLearning365]()
๐ Table of Contents
From Beginner to Pro: Setting Up Your Development Powerhouse
Choosing Your Development Environment Wisely
Installing & Configuring Visual Studio 2022 Like an Expert
VS Code: The Lightweight Powerhouse Setup
Mastering .NET CLI for Ultimate Productivity
Essential Extensions Every ASP.NET Core Developer Needs
Project Templates & Scaffolding Like a Pro
Debugging Setup: From Basic to Advanced Techniques
Version Control Integration: Git Mastery
Performance Optimization & Tool Configuration
Docker Development Environment Setup
CI/CD Pipeline Preparation
Troubleshooting Common Setup Issues
Pro Tips & Workflow Automation
What's Next: Database Integration in Part 3
1. From Beginner to Pro: Setting Up Your Development Powerhouse ๐
1.1 The Professional Mindset
Welcome to Part 2 of our ASP.NET Core mastery series! If Part 1 was about getting started, Part 2 is about setting up like a seasoned professional. The right development environment isn't just about having tools installedโit's about creating a workflow that makes you 10x more productive .
Real-World Analogy: Think of your development setup like a professional chef's kitchen:
Beginner Setup = Basic home kitchen with essential tools
Pro Setup = Commercial kitchen with specialized equipment, optimized workflow, and everything within reach
1.2 What You'll Achieve
By the end of this guide, you'll have:
โ
Expert IDE Configuration: Visual Studio 2022 or VS Code optimized for ASP.NET Core
โ
CLI Mastery: .NET CLI commands that save hours weekly
โ
Essential Extensions: Must-have tools that professional developers use
โ
Efficient Workflow: From code to deployment in minimal steps
โ
Debugging Powerhouse: Advanced debugging techniques
โ
Automation Setup: Scripts and configurations that work for you
2. Choosing Your Development Environment Wisely ๐ฏ
2.1 Visual Studio 2022 vs Visual Studio Code: The Professional Choice
Decision Matrix for 2025 :
Scenario | Recommended IDE | Why | Setup Complexity |
---|
Enterprise Development | Visual Studio 2022 | Full integration, debugging, profiling | Medium |
Startup/Agile Teams | VS Code | Lightweight, fast, customizable | Low |
Learning & Experiments | VS Code | Simple, focused, modern | Low |
Legacy + New Projects | Both | Context-specific usage | High |
2.2 System Requirements Analysis
csharp
public class SystemRequirements{
// Minimum (Functional)
public class MinimumSpecs
{
public string RAM => "8GB";
public string Storage => "SSD 256GB";
public string Processor => "Intel i5 / Ryzen 5";
public string OS => "Windows 10 / macOS 11 / Linux Ubuntu 20.04";
}
// Recommended (Professional)
public class RecommendedSpecs
{
public string RAM => "16GB+ (32GB for Docker)";
public string Storage => "NVMe SSD 512GB+";
public string Processor => "Intel i7 / Ryzen 7+";
public string OS => "Windows 11 / macOS 13+ / Linux Ubuntu 22.04+";
}
// Ideal (Power User)
public class IdealSpecs
{
public string RAM => "32GB+";
public string Storage => "NVMe SSD 1TB+";
public string Processor => "Intel i9 / Ryzen 9";
public string OS => "Latest stable versions";
}}
3. Installing & Configuring Visual Studio 2022 Like an Expert ๐ ๏ธ
3.1 The Perfect Visual Studio 2022 Installation
Step 1: Download the Right Edition
bash
# Professional choice: Visual Studio 2022 Community (Free) or Professional# Download from: https://visualstudio.microsoft.com/downloads/
# Verify download integrity
certutil -hashfile vs_installer.exe SHA256
Step 2: Workload Selection Strategy
json
// workloads.json - Professional ASP.NET Core developer selection{"essential_workloads": [
"ASP.NET and web development",
".NET Multi-platform App UI development",
"Azure development",
"Data storage and processing"],"optional_workloads": [
"Visual Studio extension development",
"Game development with Unity",
"Mobile development with .NET (MAUI)"],"individual_components": [
"Git for Windows",
"GitHub extension for Visual Studio",
".NET Framework 4.8 targeting pack",
"Windows 10 SDK (10.0.19041.0)"]}
Step 3: Installation Command Line (Advanced)
powershell
# Professional silent installation for consistent team setup
vs_enterprise.exe --installPath "C:\VS2022" ^
--add Microsoft.VisualStudio.Workload.NetWeb ^
--add Microsoft.VisualStudio.Workload.Azure ^
--add Microsoft.VisualStudio.Workload.ManagedDesktop ^
--add Microsoft.VisualStudio.Workload.Data ^
--includeRecommended ^
--quiet ^
--norestart
3.2 Visual Studio 2022 Configuration Mastery
3.2.1 Performance Optimization Settings
json
// CurrentSettings.vssettings (Professional Configuration){"TextEditor": {
"General": {
"TrackChanges": false, // Better performance
"SelectionMargin": true,
"AutoDelimiterHighlighting": true
}},"Debugging": {
"General": {
"EnableDiagnosticTools": true,
"ShowExceptionHelp": true,
"EnableHotReload": true
}},"Environment": {
"Startup": {
"OnStartup": "ShowEmptyEnvironment"
},
"Documents": {
"ReuseSavedActiveDocWindow": true,
"DetectFileChangesOutsideIDE": true
}}}
3.2.2 Keyboard Shortcuts Customization
csharp
// Professional ASP.NET Core Developer Shortcutspublic class EssentialShortcuts
{
// Navigation
public string GoToDefinition => "F12";
public string FindAllReferences => "Shift+F12";
public string NavigateBack => "Ctrl+-";
public string NavigateForward => "Ctrl+Shift+-";
// Debugging
public string ToggleBreakpoint => "F9";
public string StartDebugging => "F5";
public string StartWithoutDebugging => "Ctrl+F5";
public string StepOver => "F10";
public string StepInto => "F11";
// Code Editing
public string QuickActions => "Ctrl+.";
public string FormatDocument => "Ctrl+K, Ctrl+D";
public string CommentSelection => "Ctrl+K, Ctrl+C";
public string UncommentSelection => "Ctrl+K, Ctrl+U";
// Build & Run
public string BuildSolution => "Ctrl+Shift+B";
public string RebuildSolution => "Ctrl+Alt+F7";
public string RunTests => "Ctrl+R, T";}
4. VS Code: The Lightweight Powerhouse Setup โก
4.1 Professional VS Code Installation
Cross-Platform Installation Commands :
bash
# Windows (PowerShell)
winget install Microsoft.VisualStudioCode
# macOS (Homebrew)
brew install --cask visual-studio-code
# Linux (Ubuntu/Debian)sudo snap install code --classic
# Linux (Alternative)wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c echo 'deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main' > /etc/apt/sources.list.d/vscode.list
sudo apt update
sudo apt install code
4.2 Essential Settings Configuration
json
// settings.json (Professional ASP.NET Core Development){// Editor Behavior"editor.fontFamily": "'Cascadia Code', 'Consolas', 'Courier New', monospace","editor.fontSize": 14,"editor.lineHeight": 1.5,"editor.minimap.enabled": true,"editor.wordWrap": "on",
// C# Specific Settings"csharp.suppressDotnetInstallWarning": true,"csharp.format.enable": true,"omnisharp.enableRoslynAnalyzers": true,"omnisharp.enableEditorConfigSupport": true,
// Debugging"debug.onTaskErrors": "showErrors","debug.internalConsoleOptions": "openOnSessionStart",
// Files & Auto-save"files.autoSave": "afterDelay","files.autoSaveDelay": 1000,"files.exclude": {
"**/node_modules": true,
"**/bin": true,
"**/obj": true,
"**/.git": true},
// Terminal Integration"terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\7\\pwsh.exe","terminal.integrated.defaultProfile.windows": "PowerShell",
// ASP.NET Core Specific"dotnet.defaultSolution": "**/*.sln","html.autoClosingTags": true,"css.format.enable": true}
5. Mastering .NET CLI for Ultimate Productivity ๐ป
5.1 Essential .NET CLI Commands Every Pro Knows
bash
# Project Creation Mastery
dotnet new web -n MyProfessionalApp -f net8.0
dotnet new webapi -o ProfessionalApi --no-https
dotnet new mvc -au Individual -o SecureWebApp
# Solution Management
dotnet new sln -n EnterpriseSolution
dotnet sln add **/*.csproj
dotnet sln list
# Build & Run Optimization
dotnet build --configuration Release --verbosity minimal
dotnet run --configuration Release --urls "https://localhost:5001"
dotnet watch run --non-interactive
# Testing Like a Pro
dotnet test --logger "trx;LogFileName=testresults.trx"
dotnet test --filter "Category=Integration"
dotnet test --blame-hang-timeout 5min
# Advanced Commands
dotnet publish --self-contained true --runtime win-x64
dotnet ef migrations add InitialCreate --context ApplicationDbContext
dotnet user-secrets set "ConnectionStrings:Default" "Server=localhost;..."
5.2 Creating Custom Project Templates
json
// .template.config/template.json{"$schema": "http://json.schemastore.org/template","author": "Your Name","classifications": [ "Web", "API", "C#", "ASP.NET Core" ],"identity": "YourName.ProfessionalWebAPI","name": "Professional Web API Template","shortName": "proapi","tags": {
"language": "C#",
"type": "project"},"sourceName": "ProfessionalWebAPI","preferNameDirectory": true,"symbols": {
"enableSwagger": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Enable Swagger documentation"
},
"enableDocker": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Enable Docker support"
}}}
6. Essential Extensions Every ASP.NET Core Developer Needs ๐
6.1 Visual Studio 2022 Must-Have Extensions
csharp
public class VSEssentialExtensions{
// Productivity Boosters
public List<string> Productivity => new()
{
"Productivity Power Tools",
"CodeMaid",
"GitHub Extension for Visual Studio",
"Microsoft Visual Studio Installer Projects"
};
// ASP.NET Core Specific
public List<string> AspNetCore => new()
{
"ASP.NET Core VS Tools",
"Razor Language Services",
"Microsoft Web Developer Tools",
"Web Compiler"
};
// Code Quality
public List<string> CodeQuality => new()
{
"SonarLint for Visual Studio",
"Roslynator",
"Microsoft Code Analysis",
"ReSharper" // Optional - resource intensive
};
// DevOps & Deployment
public List<string> DevOps => new()
{
"Azure DevOps Extension",
"Docker Tools for Visual Studio",
"Azure Functions and Web Jobs Tools",
"Web Essentials"
};}
6.2 VS Code Extension Power Pack
json
// .vscode/extensions.json (Professional Setup){"recommendations": [
// C# & .NET Core
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit",
"ms-dotnettools.vscodeintellicode",
"k--kato.docomment",
// Web Development
"ms-dotnettools.blazorwasm-companion",
"doggy8088.netcore-snippets",
"formulahendry.dotnet-test-explorer",
// Productivity
"eamodio.gitlens",
"christian-kohler.path-intellisense",
"ms-vscode.vscode-settings-cycler",
// Frontend (if needed)
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"ms-vscode.vscode-typescript-next",
// Database
"ms-mssql.mssql",
"mtxr.sqltools",
// Containers & DevOps
"ms-azuretools.vscode-docker",
"ms-vscode.azure-account",
"github.vscode-pull-request-github",
// Testing
"formulahendry.dotnet-test-explorer",
"ryanluker.vscode-coverage-gutters",
// Themes & UI
"pkief.material-icon-theme",
"ms-vscode.theme-quietlight"]}
7. Project Templates & Scaffolding Like a Pro ๐
7.1 Professional Project Structure
bash
# Enterprise-Grade Project Structure
EnterpriseSolution/
โโโ src/
โ โโโ WebAPI/ # Main API Project
โ โ โโโ Controllers/
โ โ โโโ Models/
โ โ โโโ Services/
โ โ โโโ Program.cs
โ โ โโโ WebAPI.csproj
โ โโโ Application/ # Business Logic
โ โ โโโ Commands/
โ โ โโโ Queries/
โ โ โโโ Interfaces/
โ โ โโโ Application.csproj
โ โโโ Infrastructure/ # Data & External
โ โโโ Data/
โ โโโ Repositories/
โ โโโ ExternalServices/
โ โโโ Infrastructure.csproj
โโโ tests/
โ โโโ WebAPI.Tests/
โ โโโ Application.Tests/
โ โโโ Infrastructure.Tests/
โโโ docs/ # Documentation
โโโ scripts/ # Build & Deployment
โโโ EnterpriseSolution.sln
7.2 Advanced Scaffolding with Custom Templates
csharp
// Custom Controller Templateusing Microsoft.AspNetCore.Mvc;
namespace [namespace]{
[ApiController]
[Route("api/[controller]")]
public class [controllerName]Controller : ControllerBase
{
private readonly ILogger<[controllerName]Controller> _logger;
public [controllerName]Controller(ILogger<[controllerName]Controller> logger)
{
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<[modelName]>>> Get[modelName]s()
{
_logger.LogInformation("Getting all [modelName]s");
// Implementation here
return Ok(new List<[modelName]>());
}
[HttpGet("{id}")]
public async Task<ActionResult<[modelName]>> Get[modelName](int id)
{
_logger.LogInformation("Getting [modelName] with ID: {Id}", id);
// Implementation here
return Ok(new [modelName]());
}
[HttpPost]
public async Task<ActionResult<[modelName]>> Create[modelName]([modelName] model)
{
_logger.LogInformation("Creating new [modelName]");
// Implementation here
return CreatedAtAction(nameof(Get[modelName]), new { id = model.Id }, model);
}
[HttpPut("{id}")]
public async Task<IActionResult> Update[modelName](int id, [modelName] model)
{
_logger.LogInformation("Updating [modelName] with ID: {Id}", id);
// Implementation here
return NoContent();
}
[HttpDelete("{id}")]
public async Task<IActionResult> Delete[modelName](int id)
{
_logger.LogInformation("Deleting [modelName] with ID: {Id}", id);
// Implementation here
return NoContent();
}
}}
8. Debugging Setup: From Basic to Advanced Techniques ๐
8.1 Professional launchSettings.json
json
// Properties/launchSettings.json (Professional Configuration){"profiles": {
"WebAPI": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7000;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_DETAILEDERRORS": "true",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"publishAllPorts": true,
"useSSL": true,
"httpPort": 5000,
"sslPort": 5001
},
"Production": {
"commandName": "Project",
"dotnetRunMessages": false,
"launchBrowser": false,
"applicationUrl": "https://localhost:7000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}}}
8.2 Advanced Debugging Configuration
json
// .vscode/launch.json (VS Code Professional Debugging){"version": "0.2.0","configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/WebAPI/bin/Debug/net8.0/WebAPI.dll",
"args": [],
"cwd": "${workspaceFolder}/src/WebAPI",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)",
"uriFormat": "%s/swagger"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_DETAILEDERRORS": "true"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
{
"name": "Docker .NET Core Launch",
"type": "docker",
"request": "launch",
"preLaunchTask": "docker-run: debug",
"netCore": {
"appProject": "${workspaceFolder}/src/WebAPI/WebAPI.csproj"
}
}],"compounds": [
{
"name": "API & Database",
"configurations": [".NET Core Launch (web)", "Attach to Database"]
}]}
9. Version Control Integration: Git Mastery ๐
9.1 Professional Git Configuration
bash
# Global Git Configurationgit config --global user.name "Your Professional Name"git config --global user.email "[email protected]"git config --global init.defaultBranch main
git config --global core.autocrlf truegit config --global core.safecrlf warn
git config --global pull.rebase false
# Professional Aliasesgit config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'git config --global alias.last 'log -1 HEAD'git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
9.2 Professional .gitignore for ASP.NET Core
gitignore
# Professional ASP.NET Core .gitignore
## .NET Core
**/bin/
**/obj/
**/publish/
*.user
*.userosscache
*.sln.docstates
*.nupkg
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio
.vs/
.vscode/
*.swp
*.swo
*~
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Docker
**/.dockerignore
**/Dockerfile
**/docker-compose.yml
**/docker-compose.*.yml
**/compose.yml
# Azure
.azure/
# Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/
# JetBrains Rider
.idea/
*.sln.iml
# Microsoft Edge
*.ldb
# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
# macOS
.DS_Store
10. Performance Optimization & Tool Configuration โก
10.1 Build Performance Optimization
xml
<!-- Directory.Build.props - Build Optimization --><Project><PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<!-- Performance Optimizations -->
<UseSharedCompilation>true</UseSharedCompilation>
<BuildInParallel>true</BuildInParallel>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
<!-- Code Analysis -->
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode></PropertyGroup></Project>
10.2 Professional EditorConfig
ini
# .editorconfig - Professional Code Styleroot = true
[*]indent_style = spaceindent_size = 2end_of_line = lfcharset = utf-8trim_trailing_whitespace = trueinsert_final_newline = true
[*.{cs,csx,vb,vbx}]indent_size = 4insert_final_newline = true
# C# files[*.cs]# Language rulesdotnet_style_require_accessibility_modifiers = alwaysdotnet_style_readonly_field = true:suggestion
# Formatting rulesdotnet_sort_system_directives_first = truecsharp_new_line_before_open_brace = allcsharp_new_line_before_else = truecsharp_new_line_before_catch = truecsharp_new_line_before_finally = true
# this. and Me. preferencesdotnet_style_qualification_for_field = falsedotnet_style_qualification_for_property = falsedotnet_style_qualification_for_method = falsedotnet_style_qualification_for_event = false
# Expression-level preferencesdotnet_style_object_initializer = true:suggestiondotnet_style_collection_initializer = true:suggestiondotnet_style_explicit_tuple_names = true:suggestiondotnet_style_coalesce_expression = true:suggestiondotnet_style_null_propagation = true:suggestion
# Naming rulesdotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestiondotnet_naming_rule.interface_should_be_begins_with_i.symbols = interfacedotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_symbols.interface.applicable_kinds = interfacedotnet_naming_style.begins_with_i.capitalization = pascal_casedotnet_naming_style.begins_with_i.required_prefix = I
11. Docker Development Environment Setup ๐ณ
11.1 Professional Docker Configuration
dockerfile
# Dockerfile (Professional ASP.NET Core Setup)
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# Install curl for health checks
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
# Copy project files
COPY ["src/WebAPI/WebAPI.csproj", "src/WebAPI/"]
COPY ["src/Application/Application.csproj", "src/Application/"]
COPY ["src/Infrastructure/Infrastructure.csproj", "src/Infrastructure/"]
# Restore dependencies
RUN dotnet restore "src/WebAPI/WebAPI.csproj"
# Copy everything else and build
COPY . .
WORKDIR "/src/src/WebAPI"
RUN dotnet build "WebAPI.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "WebAPI.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebAPI.dll"]
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:80/health || exit 1
11.2 Docker Compose for Development
yaml
# docker-compose.yml - Professional Development Setupversion: '3.8'
services:webapi:
image: ${DOCKER_REGISTRY-}webapi
build:
context: .
dockerfile: src/WebAPI/Dockerfile
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
- ConnectionStrings__DefaultConnection=Server=db;Database=AppDb;User=sa;Password=YourPassword123!;
ports:
- "5000:80"
- "5001:443"
volumes:
- ~/.aspnet/https:/https:ro
- ./src/WebAPI:/app/src
depends_on:
- db
networks:
- app-network
db:
image: mcr.microsoft.com/mssql/server:2019-latest
environment:
SA_PASSWORD: "YourPassword123!"
ACCEPT_EULA: "Y"
ports:
- "1433:1433"
volumes:
- sqldata:/var/opt/mssql
networks:
- app-network
redis:
image: redis:alpine
ports:
- "6379:6379"
networks:
- app-network
volumes:sqldata:
networks:app-network:
driver: bridge
12. CI/CD Pipeline Preparation ๐
12.1 GitHub Actions Workflow
yaml
# .github/workflows/dotnet.ymlname: .NET Core CI
on:push:
branches: [ main, develop ]pull_request:
branches: [ main ]
env:DOTNET_VERSION: '8.0.x'PROJECT_PATH: 'src/WebAPI/WebAPI.csproj'
jobs:build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore ${{ env.PROJECT_PATH }}
- name: Build
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore
- name: Test
run: dotnet test ${{ env.PROJECT_PATH }} --configuration Release --no-build --verbosity normal
- name: Publish
run: dotnet publish ${{ env.PROJECT_PATH }} --configuration Release --no-build --output ./publish
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: webapi
path: ./publish
docker:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: docker build -t webapi:latest .
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image
run: docker push webapi:latest
13. Troubleshooting Common Setup Issues ๐ง
13.1 Common Problems & Solutions
csharp
public class SetupTroubleshooting{
// Problem: .NET SDK not found
public string SdkNotFound => "Solution: Install .NET 8 SDK and restart terminal";
// Problem: Visual Studio slow performance
public string VSSlow => """
Solutions:
1. Disable unnecessary extensions
2. Clear Visual Studio cache
3. Increase RAM allocation in devenv.exe.config
4. Disable hardware acceleration if having GPU issues
""";
// Problem: Build errors after upgrade
public string BuildErrors => """
Solutions:
1. Clean solution and rebuild
2. Delete bin/obj folders
3. Check target framework in .csproj
4. Update NuGet packages
""";
// Problem: Docker container won't start
public string DockerIssues => """
Solutions:
1. Check Docker Desktop is running
2. Verify ports aren't already in use
3. Check Dockerfile syntax
4. Review container logs: docker logs <container_id>
""";}
13.2 Performance Monitoring Scripts
powershell
# monitor-performance.ps1 - Professional Performance Monitoringparam(
[int]$Duration = 300,
[int]$Interval = 5
)
Write-Host "Monitoring ASP.NET Core Performance for $Duration seconds..." -ForegroundColor Green
$endTime = (Get-Date).AddSeconds($Duration)
while ((Get-Date) -lt $endTime) {
$process = Get-Process -Name "dotnet" -ErrorAction SilentlyContinue
if ($process) {
$cpu = ($process.CPU | Measure-Object -Sum).Sum
$memory = [math]::Round($process.WorkingSet64 / 1MB, 2)
Write-Host "CPU: $cpu% | Memory: $memory MB | Threads: $($process.Threads.Count)" -ForegroundColor Yellow
} else {
Write-Host "No dotnet process found" -ForegroundColor Red
}
Start-Sleep -Seconds $Interval}
Write-Host "Performance monitoring completed" -ForegroundColor Green
14. Pro Tips & Workflow Automation ๐ค
14.1 PowerShell Profile Automation
powershell
# Microsoft.PowerShell_profile.ps1 - Professional Developer Profile
# ASP.NET Core Aliasesfunction dotnet-run-watch { dotnet watch run }function dotnet-test-all { dotnet test --logger "trx" --results-directory "./TestResults" }function dotnet-clean-all { Get-ChildItem -Recurse -Include bin,obj | Remove-Item -Recurse -Force }function dotnet-restore-all { Get-ChildItem -Recurse -Include *.csproj | ForEach-Object { dotnet restore $_.FullName } }
# Docker Aliasesfunction docker-clean { docker system prune -f }function docker-logs { docker logs -f $args[0] }function docker-restart { docker-compose down && docker-compose up -d }
# Git Aliasesfunction gs { git status }function ga { git add . }function gc { git commit -m $args[0] }function gp { git push }function gpl { git pull }
# Development Utilitiesfunction open-solution { Get-ChildItem -Recurse -Filter *.sln | Select-Object -First 1 | Invoke-Item }function find-in-files { Get-ChildItem -Recurse -File -Include *.cs | Select-String $args[0] }function measure-build { Measure-Command { dotnet build --configuration Release } }
# Environment Setupfunction setup-dev {
Write-Host "Setting up development environment..." -ForegroundColor Green
# Check .NET SDK
dotnet --version
# Check Docker
docker --version
docker-compose --version
# Check Git
git --version
Write-Host "Development environment ready!" -ForegroundColor Green
}
# Import common functions. "$PSScriptRoot\dev-utils.ps1"
14.2 Bash Profile for Linux/macOS
bash
# ~/.bash_profile - Professional ASP.NET Core Developer
# ASP.NET Core Aliasesalias dnrun='dotnet run'alias dnb='dotnet build'alias dnt='dotnet test'alias dnw='dotnet watch run'alias dnp='dotnet publish -c Release'
# Docker Aliasesalias dc='docker-compose'alias dcd='docker-compose down'alias dcu='docker-compose up -d'alias dcl='docker-compose logs -f'
# Git Aliasesalias gs='git status'alias ga='git add .'alias gc='git commit -m'alias gp='git push'alias gpl='git pull'
# Development Utilitiesfind_cs() { find . -name "*.cs" -type f | grep "$1"; }clean_sln() { find . -name "bin" -o -name "obj" | xargs rm -rf; }measure_time() { time eval "$@"; }
# Environment Setupsetup_dev() {
echo "Setting up development environment..."
# Check installations
dotnet --version
docker --version
git --version
echo "Development environment ready!"}
# Professional Promptexport PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
15. What's Next: Database Integration in Part 3 ๐ฎ
Coming in Part 3: Professional Database Integration
Entity Framework Core Mastery: Advanced database operations
Database Migrations: Professional schema management
Repository & Unit of Work Patterns: Enterprise data access
Performance Optimization: Query tuning and indexing
Database Providers: SQL Server, PostgreSQL, SQLite choices
Testing Strategies: Integration testing with real databases
Your Professional Setup Checklist:
โ
IDE Mastery: Visual Studio 2022 or VS Code optimized
โ
CLI Expertise: .NET CLI commands and automation
โ
Extension Ecosystem: Essential productivity tools
โ
Debugging Setup: Professional debugging configuration
โ
Version Control: Git workflow and best practices
โ
Docker Environment: Containerized development
โ
CI/CD Foundation: Pipeline preparation
โ
Performance Optimization: Build and runtime tuning
โ
Automation Scripts: Time-saving workflows
Professional Achievement : You've now set up a development environment that matches enterprise standards. This foundation will make you significantly more productive throughout your ASP.NET Core journey.
๐ฏ Key Professional Setup Takeaways
โ
Tool Selection: Right IDE for your workflow
โ
Configuration Mastery: Optimized settings for productivity
โ
Extension Ecosystem: Essential tools that professionals use
โ
CLI Proficiency: Command-line efficiency
โ
Debugging Setup: Advanced troubleshooting capabilities
โ
Version Control: Professional Git workflow
โ
Containerization: Docker development environment
โ
Automation: Scripts and aliases that save time
โ
Performance: Optimized build and runtime
โ
CI/CD Ready: Pipeline preparation
Remember: A professional development environment isn't about having the most toolsโit's about having the right tools configured perfectly for your workflow.
My Main Article: https://www.freelearning365.com/2025/10/aspnet-core-pro-setup-guide-part-2.html
๐ASP.NET Core Mastery with Latest Features : 40-Part Series