This directory contains all production source code for the solution.
Organize your projects logically:
src/
├── YourCompany.YourProduct.Core/ # Core business logic
├── YourCompany.YourProduct.Api/ # API/Web project
├── YourCompany.YourProduct.Data/ # Data access layer
└── YourCompany.YourProduct.Shared/ # Shared utilities and models
Use the following naming pattern for projects:
[CompanyName].[ProductName].[Component]
Examples:
Contoso.ECommerce.CoreContoso.ECommerce.ApiContoso.ECommerce.Data
- Right-click on the
srcfolder in Solution Explorer - Select Add > New Project
- Choose your project template
- Name your project following the convention
- The project will be automatically added to
Solution.slnx
# Create a new project
dotnet new classlib -n YourCompany.YourProduct.Core -o src/YourCompany.YourProduct.Core
# Add to solution
dotnet sln add src/YourCompany.YourProduct.Core/YourCompany.YourProduct.Core.csproj- One project per functional component
- Keep dependencies minimal and explicit
- Follow SOLID principles
- Use dependency injection
- Document public APIs with XML comments