Large .NET solutions can become difficult to work with as the number of projects, dependencies, source files, analyzers, and build configurations increases. Opening a solution may take longer than expected, IntelliSense can become slow, and code navigation or debugging may consume more system resources. These problems affect productivity, especially when developers work with enterprise applications containing dozens or hundreds of projects.
Improving performance does not always require upgrading hardware or removing useful development features. In many cases, the real improvement comes from loading only the projects you need, reducing unnecessary background work, reviewing project dependencies, and identifying which tools are consuming resources.
One important distinction is worth understanding before making changes: C# Dev Kit is an extension for Visual Studio Code, not an extension for the Visual Studio IDE. It builds on the C# language support provided by the C# extension and adds project management, Solution Explorer, testing, and debugging experiences. Visual Studio, meanwhile, has its own project system and solution-loading features. This article covers both environments where the techniques apply, with particular attention to large .sln files and C# Dev Kit workflows.
Why Large C# Solutions Become Slow
A large solution is not slow simply because it contains many C# files. The development environment must understand project relationships, evaluate project files, resolve NuGet packages, load framework references, discover analyzers, and prepare information for IntelliSense and code navigation.
Several factors can contribute to performance problems.
Too many projects loaded at the same time
An enterprise solution might contain separate projects for APIs, business services, data access, shared libraries, background workers, integration tests, and unit tests. A developer working on one API may not need every project loaded.
Loading all projects can increase memory consumption and the amount of work required during solution initialization. It can also increase the time needed for project evaluation, dependency analysis, and design-time builds.
Complex project dependencies
Project references determine how projects depend on one another. A change in a shared library can affect several downstream projects. Large dependency graphs make it harder for development tools to determine which projects need to be evaluated or refreshed.
Unnecessary references, circular dependencies, and overly broad shared projects can make this problem worse.
Background code analysis
C# language services provide features such as IntelliSense, diagnostics, code navigation, refactoring, and symbol information. These features depend on project information and code analysis.
Analyzing an entire solution can consume more CPU and memory than analyzing only the files a developer is currently editing. Large analyzer packages and source generators can add additional work.
Package restore and design-time builds
NuGet restore resolves package dependencies and creates the assets required by the build system. Design-time builds provide information that editors and language services need, such as references, compiler options, and generated files.
If a project has many dependencies, multiple target frameworks, or expensive custom MSBuild targets, these operations can affect the editing experience even when the developer is not performing a normal build.
Generated files and extensions
Generated source files, large resource folders, and unnecessary extensions can add background work. Some extensions perform indexing, scanning, or project analysis. When several tools perform similar operations, CPU and memory usage can increase.
The first step is to identify which activity is slow rather than changing settings randomly.
Measure Performance Before Making Changes
Performance optimization should begin with a baseline. Record how long the solution takes to open, how much time project loading requires, and whether the slowdown occurs during editing, building, testing, or debugging.
For example, a solution may open quickly but take several minutes before IntelliSense becomes available. That indicates a different problem from a solution that takes several minutes just to initialize its projects.
Use the following measurements:
Area | What to measure | Possible cause |
|---|
Solution loading | Time until projects are ready | Project evaluation or dependency graph |
IntelliSense | Delay when typing or opening files | Language service or code analysis |
Build | Time for a normal build | MSBuild targets, analyzers, or compilation |
Package restore | Time required to restore dependencies | NuGet configuration or network |
Memory | Memory used by the IDE and related processes | Large workspace or background services |
CPU | Sustained CPU usage while idle | Indexing, analyzers, extensions, or generators |
Testing | Time to discover and execute tests | Test adapters, project loading, or test configuration |
On Windows, Task Manager can help identify processes that consume resources. In Visual Studio, also inspect the Output window and performance notifications. In VS Code, check the Output panel and select the relevant C# or Projects output channel.
Avoid assuming that high CPU usage always indicates a problem. Initial indexing, project loading, and compilation can temporarily use significant resources. The important question is whether the activity continues unnecessarily after the workspace becomes ready.
Use Solution Filters to Load Only Required Projects
One of the most useful techniques for large Visual Studio solutions is solution filtering.
A solution filter uses the .slnf file extension. It allows developers to open a solution with only selected projects loaded instead of initializing every project in the original solution.
For example, consider an application with these projects:
CompanyApp.sln
│
├── CompanyApp.Api
├── CompanyApp.Application
├── CompanyApp.Domain
├── CompanyApp.Infrastructure
├── CompanyApp.Worker
├── CompanyApp.Reporting
├── CompanyApp.IntegrationTests
└── CompanyApp.UnitTests
A developer working on the API may only need the API, application, domain, and infrastructure projects. Loading reporting and worker projects may not be necessary for that task.
Create a solution filter in Visual Studio
You can create a solution filter through Visual Studio:
Open the solution.
Unload projects that are not required for your current task.
Keep the required projects loaded.
Select File and then Save Solution As Filter.
Save the generated .slnf file.
You can commit the filter to source control so other developers can use the same project-loading configuration.
Visual Studio also provides options to load direct project dependencies or the entire dependency tree. These options are useful when a selected project depends on other projects that are currently unloaded.
Understand the solution filter structure
A solution filter is a JSON file that references the original solution and lists the projects to load.
For example:
{
"solution": {
"path": "CompanyApp.sln",
"projects": [
"CompanyApp.Api/CompanyApp.Api.csproj",
"CompanyApp.Application/CompanyApp.Application.csproj",
"CompanyApp.Domain/CompanyApp.Domain.csproj",
"CompanyApp.Infrastructure/CompanyApp.Infrastructure.csproj"
]
}
}
The project paths are relative to the solution filter file. Keep the filter in a location where those paths resolve correctly.
When a developer opens this filter, Visual Studio loads the selected projects. Other projects remain part of the original solution but are not loaded into the current filtered session.
A solution filter does not remove projects from the original solution or change the application's architecture. It only controls which projects are loaded for that working session.
When to use solution filters
Solution filters are especially useful when:
A solution contains many independent applications or services.
Developers work on different modules.
Unit tests and integration tests are maintained in separate projects.
Only a small group of projects is required for a particular feature.
A team wants consistent project-loading configurations.
For C# Dev Kit users working in VS Code, solution and project management is provided through the extension's Solution Explorer. Do not assume that every Visual Studio solution-filter workflow or menu command is available in VS Code. Check the supported project-management features in the installed C# Dev Kit version.
Configure Visual Studio Solution Loading
Visual Studio includes several settings that influence how solutions are opened and restored. These settings are useful when developers regularly work with large solutions.
Open Tools, select Options, and navigate to Projects and Solutions, then General.
Review the following options.
Disable unnecessary document restoration
Visual Studio can reopen documents that were open when the previous session ended. This is convenient, but restoring many files and designers can delay solution loading.
If you do not need automatic document restoration, clear Reopen documents on solution load.
You can still navigate to recently used files through Visual Studio's navigation commands.
Review Solution Explorer hierarchy restoration
Visual Studio can restore the expanded and collapsed state of project nodes when reopening a solution.
For large solutions, restoring a complicated Solution Explorer hierarchy can add unnecessary work. Clear Restore Solution Explorer project hierarchy state on solution load if you do not need this behavior.
In Visual Studio 2026 version 18.11, this setting also controls hierarchy restoration when reopening a folder through Open Folder.
Enable parallel project initialization
The Allow parallel project initialization option can help Visual Studio load large .NET solutions faster when reopening the same solution.
Measure the effect in your environment because project structure, available resources, and dependencies influence the result.
Review the Performance Manager
Visual Studio provides a Performance Manager that identifies extensions and tool windows affecting startup, solution loading, or typing performance.
Open Help and select Visual Studio Performance Manager. Review the extensions listed under the relevant performance categories.
Disable an extension only when measurements indicate that it is contributing to the problem. Recheck performance after each change so you can identify which extension made a difference.
Optimize C# Dev Kit and Background Code Analysis
C# Dev Kit provides project management and development features in VS Code. Its behavior depends on the C# extension and the language services that provide C# editing support.
When working with a large workspace, review how much code is analyzed in the background.
Choose an appropriate analysis scope
The C# extension provides background code analysis settings. Depending on the installed version, you can configure analysis to run on open files, open documents, the full solution, or not run in the background.
For everyday development, analyzing open files or documents can reduce unnecessary background work compared with analyzing an entire large solution.
However, limiting analysis also means that diagnostics outside the selected scope may not appear until those files are opened or a broader analysis is performed.
A practical approach is to use a narrower scope during regular editing and perform full-solution analysis before important commits or releases.
Check project loading before changing editor settings
IntelliSense depends on the project being loaded correctly. If a project has not restored successfully or the expected .NET SDK is unavailable, the editor may show incomplete suggestions or missing diagnostics.
In VS Code:
Open the Output panel.
Select Projects from the output-channel list.
Review project-loading and restore messages.
Confirm that the required .NET SDK is installed.
Check whether the solution and its projects have finished loading.
C# Dev Kit's FAQ also recommends checking the installed C# extension version. C# Dev Kit requires C# extension version 2.0 or later.
Do not treat missing IntelliSense as a performance problem until you have ruled out project-loading and SDK configuration errors.
Enable diagnostic logging when needed
If the language service is behaving unexpectedly, increase the C# extension's Dotnet Server logging level to Trace.
After changing the setting, reload the VS Code window and inspect the Projects output channel. Diagnostic logs can help identify project-loading failures and language-server problems.
Trace logging is intended for troubleshooting. Return to the normal logging level after collecting the information you need.
Review Project References and Multi-Targeting
Project structure has a direct effect on how much work the development environment needs to perform.
A project should reference only the projects and packages it actually uses. Unnecessary references can increase dependency evaluation and make builds harder to maintain.
For example, a domain project should not reference an API project simply because both belong to the same application. The dependency direction should reflect the application's architecture.
A simplified structure might look like this:
CompanyApp.Api
|
v
CompanyApp.Application
|
v
CompanyApp.Domain
CompanyApp.Infrastructure
|
v
CompanyApp.Application
The exact dependency direction depends on the architecture, but keeping boundaries clear helps prevent unnecessary project relationships.
Avoid unnecessary multi-targeting
A project may target multiple frameworks:
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>
Multi-targeting is useful when a library must support several .NET versions. However, each target framework can require separate evaluation and compilation work.
Do not remove supported target frameworks just to improve editor performance. Instead, check whether every project genuinely needs to target every framework and whether the solution can be organized so that developers work on the relevant projects.
Keep shared build configuration manageable
Files such as Directory.Build.props and Directory.Build.targets help centralize MSBuild configuration across projects.
They can also introduce unexpected complexity when they contain expensive custom targets or conditions that run during project evaluation and design-time builds.
Review shared build files for:
Custom tasks that execute unnecessarily.
Repeated package or property definitions.
Targets that run during design-time builds without needing to.
Conditions that evaluate differently across target frameworks.
Large imported configuration files that are not required by every project.
Keep shared configuration focused and test changes across representative projects before applying them to the entire repository.
Manage Analyzers and Source Generators
Analyzers and source generators improve code quality and reduce repetitive development work. However, poorly optimized analyzers or generators can affect build and editor responsiveness.
Analyzers inspect source code and report diagnostics. Source generators produce additional source files during compilation. Both can participate in design-time and regular build operations.
Review analyzer packages
Check which analyzer packages are installed and whether every project needs them.
For example, a package referenced by a shared project may be inherited by many projects. If it provides rules that are not required everywhere, consider whether its scope can be narrowed without reducing important code-quality checks.
Do not disable security, reliability, or correctness analyzers simply to make the editor faster. First identify the analyzer responsible for the extra work.
Check source generator behavior
Source generators should avoid unnecessary repeated work. Expensive file scanning, large input processing, and inefficient incremental pipelines can affect compilation.
For generator authors, prefer incremental generators using IIncrementalGenerator and incremental value providers rather than repeatedly processing the entire compilation.
For developers consuming generators, check package updates and release notes when a particular generator appears to slow down builds or editor features.
Compare build times with and without a package
For investigation, you can temporarily test a representative project with an analyzer or generator package removed in a separate branch.
Compare build time, diagnostics, and generated output. Do not remove a package from the main solution until you understand which functionality depends on it.
Reduce Unnecessary Build and Restore Work
Not every slow development operation comes from the IDE. MSBuild and NuGet configuration can also affect the experience.
Avoid restoring packages unnecessarily
When package dependencies have not changed and restore has already completed successfully, use --no-restore for a build that does not require another restore:
dotnet build CompanyApp.sln --no-restore
This is useful for repeated local builds, but it should not replace restore in a clean environment or after package configuration changes.
Build only the project you are changing
During development, build the relevant project instead of rebuilding the entire solution every time.
dotnet build src/CompanyApp.Api/CompanyApp.Api.csproj
If the project depends on other projects, MSBuild can build the required project references according to the build configuration.
For a complete validation, build the full solution in CI or before a release.
Use incremental builds correctly
MSBuild can skip work when its inputs and outputs are up to date. Avoid custom targets that always run or generate files unnecessarily.
If a custom target performs an operation on every build, review whether its inputs, outputs, and incremental conditions are configured correctly.
Do not delete all bin and obj folders as a routine performance fix. Cleaning these folders can force restore, project evaluation, and compilation work to happen again.
Diagnose Slow Builds With MSBuild Binary Logs
When a build is slow, guessing which project or target is responsible can waste time. MSBuild binary logs provide detailed information about the build process.
Run:
dotnet build CompanyApp.sln -bl:build-log.binlog
The command creates a binary log that can be opened with the MSBuild Structured Log Viewer.
Use the log to investigate:
Projects that take unusually long to evaluate.
Targets that execute repeatedly.
Slow custom MSBuild tasks.
Unexpected project references.
Repeated package or resource processing.
Time spent in compilation and other build operations.
Binary logs can contain project files, imported targets, environment-related information, file paths, and build task details. Review them for sensitive information before sharing them outside your team.
A binary log is especially useful when the same build is slow on multiple machines or when CI performance differs from local development.
Reduce Visual Studio Extension Overhead
Visual Studio extensions can add useful functionality, but some may affect startup, solution loading, or typing performance.
Open Help and select Visual Studio Performance Manager. Review the extensions reported as slow under Startup, Solution Load, or Typing.
Disable one extension at a time and repeat the same operation. This makes it easier to identify the extension responsible for the slowdown.
Also review tool windows that reopen automatically. A tool window that performs indexing or project analysis may add startup work even when you do not need it immediately.
For low-memory situations, Visual Studio's performance guidance also recommends reviewing features such as CodeLens. CodeLens can perform reference analysis and consume additional resources in large solutions. Disable it only if it is contributing to the issue or you do not use it.
For VS Code, review installed extensions in the same way. Avoid running multiple extensions that perform overlapping C# analysis, project indexing, or code navigation.
Common Performance Problems and Troubleshooting
Problem | Possible cause | Recommended action |
|---|
Solution takes a long time to open | Too many projects or document restoration | Use a solution filter and review loading settings |
IntelliSense is incomplete | Project restore or SDK detection failure | Check Projects output and installed SDK |
Typing becomes slow | Background analysis or an extension | Review analysis scope and extension performance |
Build takes too long | Expensive MSBuild targets or analyzers | Capture a binary log and inspect slow targets |
High CPU usage after loading | Indexing, source generators, or extensions | Identify the active process and inspect logs |
Tests are missing in VS Code | Project not built or loaded correctly | Build the test project and check Test Explorer output |
Razor components show warnings | Razor project information not generated correctly | Verify project loading and generated Razor metadata |
Different results across machines | SDK or package configuration mismatch | Check global.json, NuGet configuration, and SDK versions |
Check the .NET SDK version
A global.json file can specify which .NET SDK should be used by a repository.
For example:
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestFeature"
}
}
The version shown here is an example. Use a version installed on the developer's machine and supported by the project.
If C# Dev Kit reports that a compatible SDK cannot be found, check the global.json file and verify the SDK installation.
Run:
dotnet --list-sdks
This command displays the SDK versions available to the command-line environment.
Check NuGet restore failures
If projects do not load correctly, inspect NuGet output and confirm that package sources are accessible.
You can test restore separately:
dotnet restore CompanyApp.sln
A failed restore can prevent project information from becoming available to the editor. Resolve the underlying package or network problem before changing language-service settings.
Collect useful diagnostic information
When reporting a performance issue, include:
IDE and extension versions.
.NET SDK versions.
Operating system and machine architecture.
Approximate number of projects in the solution.
The operation that is slow.
Whether the problem occurs in a new workspace.
Relevant Output panel messages.
An MSBuild binary log when the issue relates to building.
A clear reproduction scenario is more useful than a general report that the solution is slow.
Best Practices for Large C# Solutions
A consistent development approach can prevent performance problems from returning.
Use solution filters or smaller working solutions when developers do not need every project.
Keep project references aligned with the application's architecture.
Use the appropriate background analysis scope for the task.
Keep analyzers and source generators updated.
Avoid unnecessary multi-targeting and expensive custom build targets.
Use incremental builds and avoid repeated package restores.
Measure Visual Studio extensions before disabling them.
Keep the .NET SDK and package configuration consistent across developer machines and CI.
Use binary logs to investigate slow builds instead of making random configuration changes.
Run full-solution builds and tests in CI so local performance optimizations do not reduce release validation.
Teams should also document the recommended solution filters and development workflow. This helps new developers avoid loading unnecessary projects and makes local development more consistent.
Advantages and Disadvantages of Performance Optimization
Approach | Advantages | Disadvantages |
|---|
Solution filters | Loads fewer projects and supports focused development | Developers must load additional dependencies when required |
Reduced background analysis | Can reduce CPU and memory usage | Some diagnostics may appear later |
Project reference cleanup | Simplifies dependency relationships | Requires architectural review and testing |
Analyzer optimization | Preserves useful code-quality checks with less overhead | Requires identifying the expensive analyzer |
Extension management | Helps isolate unnecessary background work | Disabling extensions can remove useful features |
Binary log analysis | Identifies expensive build operations | Requires time to inspect and understand the log |
No single setting solves every large-solution performance problem. The best result usually comes from combining project-loading improvements, dependency cleanup, and targeted diagnostics.
Conclusion
Improving C# Dev Kit and Visual Studio performance in large .NET solutions starts with understanding where the time and resources are being spent. Loading every project, running full-solution analysis continuously, using expensive build targets, and enabling unnecessary extensions can all affect the development experience.
Solution filters are a practical way to reduce the number of projects loaded in Visual Studio. In VS Code, C# Dev Kit users should verify project loading, SDK configuration, background analysis scope, and language-service logs. For build-related problems, MSBuild binary logs provide a reliable way to find slow operations.
The goal is not to disable useful development features. It is to make the development environment perform only the work required for the task at hand while preserving the checks and tools needed for reliable .NET applications.
Join the conversation! Your thoughts help the community grow.