ASP.NET Solutions
Understand ASP.NET solution files, project structure, dependencies, builds, and how teams manage scalable Microsoft web applications.
ASP.NET solutions are the organisational backbone of many Microsoft web applications. When a team opens an ASP.NET application in Visual Studio, Rider, VS Code, or a build pipeline, the solution file often acts as the map that connects projects, dependencies, build settings, configurations, tests, and deployment assets.
For small websites, a solution may contain one project. For enterprise systems, it may contain web applications, APIs, class libraries, test projects, shared packages, database projects, deployment scripts, infrastructure definitions, and background services. Understanding how ASP.NET solutions and .sln files work helps teams maintain cleaner codebases, build faster, onboard developers more easily, and reduce deployment risk.
What is an ASP.NET solution?
An ASP.NET solution is a container that groups one or more related projects. It is commonly represented by a .sln file, which stores references to the projects in the solution and describes how those projects are organised for development and build tooling.
A solution is not the application runtime itself. Instead, it is a development and build structure. It helps tools understand which projects belong together, which configurations exist, which projects should build, and how developers navigate the codebase.
For example, a business ASP.NET solution might include:
- Web project: The ASP.NET MVC, Razor Pages, Blazor, Web Forms, or ASP.NET Core web application.
- API project: Backend endpoints built with ASP.NET Web API or ASP.NET Core Web API.
- Domain project: Business rules, models, entities, and core application logic.
- Infrastructure project: Database access, email services, file storage, queues, third-party integrations, or external APIs.
- Shared library: Reusable helpers, contracts, DTOs, validation logic, or common utilities.
- Test projects: Unit tests, integration tests, API tests, and acceptance test helpers.
- Database project: SQL scripts, migrations, schema projects, or data deployment assets.
- Deployment project: Scripts, configuration templates, Docker files, infrastructure-as-code files, or CI/CD assets.
What is a solution file?
A solution file is usually a text file with the .sln extension. It is created by Visual Studio or compatible tooling and acts as a high-level index of the projects and build configurations in a Microsoft application workspace.
The .sln file typically records:
- The Visual Studio solution format version.
- The projects included in the solution.
- Project names, paths, types, and unique project identifiers.
- Solution folders used for organisation.
- Build configurations such as Debug and Release.
- Platform configurations such as Any CPU, x64, or x86.
- Which projects build under each configuration.
- Nested project relationships and solution-level metadata.
Although the file is human-readable, it is usually edited by development tools rather than manually. Manual edits are possible, but they should be done carefully because malformed solution files can break builds, confuse IDEs, or remove projects from the workspace.
How does a solution file work?
When a developer opens a .sln file, the IDE reads the solution structure and loads the referenced projects. Each project then loads its own project file, such as .csproj, .vbproj, .fsproj, .sqlproj, or another supported project type.
The solution file points to projects, while each project file defines its own source files, package references, framework target, build settings, dependencies, content files, and compile behaviour. In other words:
- The solution file says which projects belong together.
- The project files say how each individual project is built.
- The source files contain the application code.
- The configuration files control runtime behaviour and environment settings.
- The pipeline files automate build, test, package, and deployment steps.
Build tools such as MSBuild and dotnet build can use the solution file to build multiple projects in the correct context. Test runners can use it to discover test projects. CI/CD pipelines can use it as the main build entry point for the application.
Solution files versus project files
One common source of confusion is the difference between a solution file and a project file.
| File | Purpose | Common extension |
|---|---|---|
| Solution file | Groups multiple projects and stores solution-level build configurations. | .sln |
| C# project file | Defines how a C# project builds, including target framework, packages, files, and references. | .csproj |
| Web configuration | Controls runtime and IIS-related settings for many ASP.NET applications. | web.config |
| Application settings | Stores environment and application configuration for many ASP.NET Core applications. | appsettings.json |
| Pipeline file | Defines CI/CD build, test, packaging, and deployment automation. | azure-pipelines.yml, .github/workflows/*.yml |
A solution may reference many projects, but each project is responsible for its own compilation and dependencies. This separation allows teams to structure applications into layers and services rather than placing every file inside one large web project.
Why ASP.NET solutions matter
A well-structured solution improves maintainability. A poor solution structure can slow development, hide dependencies, create circular references, make builds unreliable, and make onboarding difficult for new developers.
Good solution design helps teams:
- Understand the architecture quickly.
- Separate web, business, infrastructure, and testing concerns.
- Build and test projects consistently.
- Manage dependencies safely.
- Reduce accidental coupling between layers.
- Support CI/CD pipelines and automated deployments.
- Prepare legacy systems for modernisation.
- Scale development across multiple engineers or teams.
Typical ASP.NET solution structures
There is no single perfect structure, but successful ASP.NET solutions usually make responsibilities clear. Here are common patterns.
Simple web application
A small ASP.NET site might contain one web project and one test project:
Company.WebCompany.Web.Tests
This is easy to understand, but it may become hard to maintain if business logic, data access, integrations, and presentation code all grow inside the web project.
Layered application
A common enterprise structure separates concerns into layers:
Company.Webfor UI or API endpoints.Company.Applicationfor use cases and orchestration.Company.Domainfor business models and rules.Company.Infrastructurefor database, email, storage, and external services.Company.Testsfor automated tests.
This approach can make the system easier to test and evolve, especially when business logic should not depend directly on web or database frameworks.
Clean architecture style
Some ASP.NET Core teams use clean architecture or domain-driven design patterns. These approaches organise dependencies so inner business rules do not depend on outer infrastructure details.
A clean architecture solution may include:
Domainfor entities, value objects, and core rules.Applicationfor commands, queries, interfaces, and use cases.Infrastructurefor persistence, messaging, identity, and integrations.WeborApifor controllers, endpoints, views, and request handling.Testsfor unit and integration coverage.
Microservices or modular monolith
Large platforms may contain multiple ASP.NET services, shared libraries, contracts, integration tests, and deployment projects. A solution can act as a workspace for several related services, but teams should avoid creating one huge solution that becomes slow, fragile, and difficult to navigate.
Build configurations: Debug and Release
Solution files store build configurations such as Debug and Release. These configurations allow the same projects to build differently depending on the purpose.
- Debug: Usually includes debugging symbols and developer-friendly settings.
- Release: Usually enables optimisations and is used for production-ready builds.
Teams can also create custom configurations such as Staging, QA, UAT, or Production, but this should be done carefully. Runtime environment configuration is often better handled through environment variables, secret stores, deployment settings, or configuration providers rather than hard-coding too much into build configurations.
Dependencies and project references
ASP.NET solutions often include project references and package references. A project reference connects one project in the solution to another, while a package reference pulls in a NuGet package.
Dependency direction matters. For example, a domain project should usually not depend on a web project. If core business logic depends on ASP.NET controllers, database implementations, or UI details, the codebase becomes harder to test and harder to change.
Good dependency management includes:
- Clear layering rules.
- Avoiding circular references.
- Keeping shared libraries small and purposeful.
- Reviewing NuGet package health and security.
- Using dependency injection for infrastructure implementations.
- Keeping business logic separate from web framework details where practical.
ASP.NET solution files in CI/CD
Build pipelines often use the solution file as the main entry point. A CI pipeline might restore dependencies, build the solution, run tests, package the web application, and publish artifacts.
A typical pipeline for an ASP.NET solution may include:
- Checkout the repository.
- Install the required .NET SDK or build tools.
- Restore NuGet packages.
- Build the
.slnfile in Release mode. - Run unit and integration tests.
- Publish test results and code coverage.
- Package the ASP.NET application.
- Apply configuration transforms or environment settings.
- Publish deployment artifacts.
- Deploy to IIS, Azure App Service, containers, or another hosting target.
When the solution is well organised, automation becomes much simpler. When the solution contains broken references, inconsistent naming, hidden dependencies, or manual build steps, CI/CD becomes slower and less reliable.
Common solution file problems
Older ASP.NET systems often accumulate solution-level problems over time. These issues can make development and deployment more difficult than necessary.
- Missing projects: The solution references projects that no longer exist.
- Broken paths: Project paths differ between developer machines or build agents.
- Unused projects: Old projects remain in the solution even though they are not used.
- Circular dependencies: Projects reference each other in ways that make builds fragile.
- Inconsistent naming: Project names do not describe their responsibility.
- Slow builds: The solution builds too much for every change.
- Poor test separation: Unit, integration, and end-to-end tests are mixed together without clear execution strategy.
- Configuration drift: Local, staging, and production settings are not handled consistently.
- Manual-only steps: Developers know undocumented build or deployment steps that the solution does not express.
- Legacy project formats: Older project files may be difficult to modernise without careful planning.
Best practices for ASP.NET solutions
A good ASP.NET solution should make the architecture understandable and the build process repeatable.
- Use clear project names: Names should explain the role of each project.
- Separate responsibilities: Keep web, business, infrastructure, and test concerns distinct where useful.
- Keep dependency direction clean: Avoid web or infrastructure details leaking into domain logic.
- Remove dead projects: Clean up old references and unused libraries.
- Make builds repeatable: A fresh developer or build agent should be able to restore, build, and test without hidden manual steps.
- Use source control carefully: Commit solution and project files when they define real workspace or build behaviour.
- Protect secrets: Do not store production credentials in project files,
web.config, or committed settings. - Add tests deliberately: Create test projects that match the architecture and pipeline strategy.
- Document conventions: Explain project boundaries, build commands, migration steps, and deployment expectations.
- Review the solution during modernisation: The solution structure often reveals technical debt, coupling, and migration opportunities.
Solutions, web.config, and deployment
ASP.NET Framework applications commonly use web.config for runtime and IIS configuration. ASP.NET Core applications may use appsettings.json, environment variables, user secrets, Key Vault, or other configuration providers, but may still include a web.config when hosted behind IIS.
The solution file does not replace these configuration files. Instead, it organises the projects that contain them. A professional deployment process should understand how the solution builds, which project produces the deployable artifact, how configuration is applied, and how the application reaches its hosting environment.
For IIS-hosted ASP.NET applications, deployment planning should cover:
- Which project is the web application entry point.
- How
web.configor environment settings are transformed. - How connection strings and secrets are protected.
- How application pool settings are managed.
- How static files, views, APIs, and compiled assemblies are packaged.
- How database migrations are coordinated.
- How rollback is handled if a release fails.
Modernising older ASP.NET solutions
Many organisations have valuable ASP.NET applications that have grown for years. The solution may include legacy Web Forms projects, MVC applications, WCF services, old class libraries, database scripts, and manual deployment folders. Modernisation does not always mean rewriting everything at once.
A practical modernisation roadmap may include:
- Inventory the solution: Identify projects, dependencies, frameworks, packages, and build outputs.
- Stabilise the build: Make the solution build reliably on a clean machine or CI agent.
- Remove dead code: Archive unused projects and reduce noise.
- Add automated tests: Start with high-value business logic and critical integration paths.
- Improve configuration: Remove hard-coded secrets and separate environment settings.
- Introduce CI/CD: Automate build, test, packaging, and release steps.
- Refactor boundaries: Move business logic out of web-specific classes where appropriate.
- Plan migration: Decide whether parts should move to ASP.NET Core, APIs, cloud services, containers, or a modular architecture.
How Eight Mile can help
Eight Mile can help with custom software development, web applications, backend APIs, cloud infrastructure, CI/CD, workflow automation, system architecture, technical consultancy, and legacy modernisation. ASP.NET solution design and solution-file cleanup sit directly within these service areas because they affect development speed, maintainability, deployment quality, and long-term system health.
For ASP.NET solution and solution-file work, Eight Mile can support:
- ASP.NET solution audits: Review project structure, dependencies, build reliability, naming, references, and architectural boundaries.
- Solution restructuring: Reorganise projects into clearer web, application, domain, infrastructure, and test layers.
- Legacy modernisation: Stabilise older ASP.NET Framework, MVC, Web Forms, Web API, and mixed Microsoft codebases.
- ASP.NET Core migration planning: Assess what can move to ASP.NET Core, what should remain, and how to migrate safely in phases.
- CI/CD implementation: Build Azure DevOps, GitHub Actions, or other pipelines that restore, build, test, package, and deploy the solution reliably.
- IIS and hosting alignment: Connect solution structure to IIS deployment, application pools, configuration transforms, certificates, and release processes.
- Testing strategy: Add unit, integration, API, and smoke tests that match the solution architecture and pipeline needs.
- Configuration improvement: Separate development, staging, and production settings while protecting secrets and reducing manual edits.
- Technical consultancy: Help teams understand whether to refactor, modularise, migrate, containerise, or rebuild parts of the system.
- Ongoing support: Maintain, improve, and troubleshoot ASP.NET applications after launch or migration.
Whether you need a clean new ASP.NET solution, help understanding a legacy .sln file, a safer build pipeline, or a full modernisation roadmap, Eight Mile can provide practical engineering support from discovery through delivery.
Conclusion
An ASP.NET solution file is more than a Visual Studio convenience. It is a structural map of the application workspace and a key part of how projects are built, tested, maintained, and deployed. When the solution is clear, teams can move faster with fewer errors. When it is messy, every change becomes harder than it needs to be.
Need help with ASP.NET solutions, solution files, or Microsoft web application modernisation? Contact Eight Mile.