Complete SMS Project Setup
Level: Intermediate
- Create multi-project solution
- Project organization
- Add references between projects
- Configuration setup
- Complete SMS structure
Create Solution
File → New → Project → Blank Solution:
Solution name: SchoolManagementSystem
Location: C:\NexCoding\SMS\
Creates: SchoolManagementSystem.sln
Add Projects
Right-click solution → Add → New Project:
1. Core Models & Services
Name: SMS.Core
Type: Class Library
Location: SchoolManagementSystem/SMS.Core
Framework: .NET 8
2. Data Access
Name: SMS.Data
Type: Class Library
Framework: .NET 8
3. API Backend
Name: SMS.Api
Type: ASP.NET Core Web API
Framework: .NET 8
4. Unit Tests
Name: SMS.Tests
Type: xUnit Test Project
Framework: .NET 8
Solution Structure
SchoolManagementSystem/
├── SchoolManagementSystem.sln
├── SMS.Core/
│ ├── Models/
│ │ ├── Student.cs
│ │ ├── Teacher.cs
│ │ ├── Exam.cs
│ │ ├── FeeAccount.cs
│ │ └── Enums.cs
│ ├── Services/
│ │ ├── StudentService.cs
│ │ ├── ExamService.cs
│ │ └── FeeService.cs
│ ├── Interfaces/
│ │ ├── IStudentService.cs
│ │ ├── IExamService.cs
│ │ └── IFeeService.cs
│ └── SMS.Core.csproj
├── SMS.Data/
│ ├── Context/
│ │ └── SmsDbContext.cs
│ ├── Repositories/
│ │ ├── StudentRepository.cs
│ │ └── ExamRepository.cs
│ ├── Migrations/
│ └── SMS.Data.csproj
├── SMS.Api/
│ ├── Controllers/
│ │ ├── StudentsController.cs
│ │ ├── ExamsController.cs
│ │ └── FeesController.cs
│ ├── Middleware/
│ ├── Program.cs
│ ├── appsettings.json
│ └── SMS.Api.csproj
├── SMS.Tests/
│ ├── StudentServiceTests.cs
│ ├── ExamServiceTests.cs
│ └── SMS.Tests.csproj
└── docs/
Add Project References
Right-click project → Add Reference:
SMS.Data references:
- ✓ SMS.Core
SMS.Api references:
- ✓ SMS.Core
- ✓ SMS.Data
SMS.Tests references:
- ✓ SMS.Core
- ✓ SMS.Data
- ✓ SMS.Api
Install Common Packages
Package Manager Console:
# For SMS.Core
Install-Package FluentValidation
Install-Package System.ComponentModel.DataAnnotations
# For SMS.Data
Install-Package Microsoft.EntityFrameworkCore
Install-Package Microsoft.EntityFrameworkCore.SqlServer
Install-Package Dapper
# For SMS.Api
Install-Package Serilog
Install-Package Serilog.AspNetCore
Install-Package Newtonsoft.Json
# For SMS.Tests
Install-Package Moq
Install-Package xunit
Install-Package xunit.runner.visualstudio
SMS.Core Models
File: SMS.Core/Models/Student.cs
using System.ComponentModel.DataAnnotations;
namespace SMS.Core.Models
{
public class Student
{
[Key]
public int Id { get; set; }
[Required]
[StringLength(50)]
public string Name { get; set; }
[Required]
[StringLength(20)]
public string RollNumber { get; set; }
[StringLength(10)]
public string ClassName { get; set; }
[StringLength(10)]
public string Section { get; set; }
[Required]
public StudentStatus Status { get; set; }
public DateTime DateOfBirth { get; set; }
}
public enum StudentStatus
{
Active = 1,
Inactive = 2,
Graduated = 3,
Transferred = 4
}
}
SMS.Core Services
File: SMS.Core/Services/StudentService.cs
using SMS.Core.Models;
namespace SMS.Core.Services
{
public interface IStudentService
{
Task<Student> GetStudentAsync(int id);
Task<List<Student>> GetStudentsAsync();
Task CreateStudentAsync(Student student);
Task UpdateStudentAsync(Student student);
Task DeleteStudentAsync(int id);
}
public class StudentService : IStudentService
{
private readonly IStudentRepository _repository;
public StudentService(IStudentRepository repository)
{
_repository = repository;
}
public async Task<Student> GetStudentAsync(int id)
{
return await _repository.GetByIdAsync(id);
}
public async Task<List<Student>> GetStudentsAsync()
{
return await _repository.GetAllAsync();
}
public async Task CreateStudentAsync(Student student)
{
await _repository.AddAsync(student);
}
public async Task UpdateStudentAsync(Student student)
{
await _repository.UpdateAsync(student);
}
public async Task DeleteStudentAsync(int id)
{
await _repository.DeleteAsync(id);
}
}
}
SMS.Api Controller
File: SMS.Api/Controllers/StudentsController.cs
using Microsoft.AspNetCore.Mvc;
using SMS.Core.Models;
using SMS.Core.Services;
namespace SMS.Api.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class StudentsController : ControllerBase
{
private readonly IStudentService _service;
public StudentsController(IStudentService service)
{
_service = service;
}
[HttpGet("{id}")]
public async Task<ActionResult<Student>> GetStudent(int id)
{
var student = await _service.GetStudentAsync(id);
if (student == null)
return NotFound();
return Ok(student);
}
[HttpGet]
public async Task<ActionResult<List<Student>>> GetStudents()
{
var students = await _service.GetStudentsAsync();
return Ok(students);
}
[HttpPost]
public async Task<ActionResult> CreateStudent([FromBody] Student student)
{
await _service.CreateStudentAsync(student);
return Created();
}
[HttpPut("{id}")]
public async Task<ActionResult> UpdateStudent(int id, [FromBody] Student student)
{
student.Id = id;
await _service.UpdateStudentAsync(student);
return NoContent();
}
[HttpDelete("{id}")]
public async Task<ActionResult> DeleteStudent(int id)
{
await _service.DeleteStudentAsync(id);
return NoContent();
}
}
}
Configure Dependencies
File: SMS.Api/Program.cs
using SMS.Core.Services;
using SMS.Data;
var builder = WebApplicationBuilder.CreateBuilder(args);
// Add services
builder.Services.AddScoped<IStudentService, StudentService>();
builder.Services.AddScoped<SmsDbContext>();
builder.Services.AddControllers();
var app = builder.Build();
app.MapControllers();
app.Run();
Build Solution
Build → Build Solution (Ctrl + Shift + B):
Build succeeded
SMS.Core: ✓ 0 warnings
SMS.Data: ✓ 0 warnings
SMS.Api: ✓ 0 warnings
SMS.Tests: ✓ 0 warnings
Key Takeaways
- Multi-project = separation of concerns
- Core = models and interfaces
- Data = database access
- Api = controllers and endpoints
- Tests = quality assurance
- DI Container = wire everything together
Use this structure for all projects. Consistent organization = easier onboarding.
- Circular references — Project A → B → A (bad)
- Everything in one project — No separation
- Missing interfaces — Hard to test
- Hardcoded dependencies — Not flexible
Use ChatGPT, Claude, or Copilot to go deeper on Project Setup. Try these prompts:
"What's the benefit of multi-project structure?""Why use interfaces for services?""How do I add project references?""Quiz me on project setup"
💡 Tip: After reading this article, paste your own code into AI and ask "What could go wrong here and why?" — fastest way to find edge cases and deepen understanding.
Final Project Section Links
Use these links to complete the full Final Project topic from the top menu:
- Final Project Overview
- School Management System API
- Visual Studio Project Setup
- Git Workflow for SMS Project
- Angular SMS Frontend
- SQL Server Tutorial
- EF Core Tutorial
- Resume Writing
Target search terms for this lesson: school management system project setup visual studio, asp.net core project setup, .net multi project solution, c# project structure for beginners, dotnet project for resume.
Developer Tools Section Links
Use these links to continue the full Dev Tools topic from the top menu:
- Visual Studio Setup
- VS Code Setup
- Git Tutorial
- GitHub Repositories
- Swagger / OpenAPI
- Postman API Testing
- SSMS Tutorial
- ASP.NET Core Web API
- SQL Server Tutorial
Target search terms for this lesson: complete sms project setup in visual studio, developer tools for .net, .net developer tools, backend developer tools, school management system tools.