Working with a large .NET repository does not always require opening an entire Visual Studio solution. Sometimes developers only need to inspect a project, review its source code, or prepare its dependencies before starting development.
Previously, restoring dependencies through the Visual Studio interface generally involved opening a solution or project in the appropriate build context. This could add unnecessary steps when working with repositories containing multiple solutions, project files, shared libraries, and build configurations.
Visual Studio 2026 introduces an improvement to its Open Folder workflow. Developers can now run MSBuild Restore directly from the folder view without opening a solution first.
The feature is particularly useful when working with large repositories, multiple solutions, shared project files, and projects that need dependency restoration before compilation.
In this article, we will understand how MSBuild dependency restoration works, explore the new Visual Studio 2026 feature, restore NuGet dependencies directly from Open Folder, understand solution-specific targeting, and troubleshoot common restore problems.
1. What Is MSBuild Dependency Restoration?
MSBuild is the build platform used by Visual Studio and .NET projects to compile applications, execute build tasks, and manage project dependencies.
A typical .NET application depends on external libraries, SDK components, and other projects.
For example, an ASP.NET Core application might use:
- Entity Framework Core.
- Microsoft.Extensions.Logging.
- Newtonsoft.Json.
- Database providers.
- Authentication libraries.
- Internal shared projects.
These dependencies must be available before the project can be compiled successfully.
Dependency restoration is the process of resolving and downloading the required packages based on the project's dependency declarations.
For NuGet-based projects, the restore process reads package references and determines which packages are required.
Consider this project file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference
Include="Microsoft.EntityFrameworkCore"
Version="10.0.0" />
<PackageReference
Include="Newtonsoft.Json"
Version="13.0.4" />
</ItemGroup>
</Project>The PackageReference elements declare external dependencies.
When MSBuild restores this project, NuGet resolves the package versions and downloads any missing packages from the configured package sources.
For projects using PackageReference, the restore process also generates an assets file named project.assets.json.
This file contains the resolved dependency information required by the build process.
Without a successful restore, the project may produce errors indicating that package references or dependency assets are missing.
2. Why Is Restoring Dependencies Important?
Dependency restoration is an important part of the .NET development lifecycle.
When developers clone a repository from GitHub or another source-control platform, the local machine may not contain all the packages required by the project.
The source code may be available, but the dependencies still need to be restored.
Consider a repository containing multiple projects:
CompanyRepository/
│
├── Company.sln
│
├── WebApi/
│ ├── WebApi.csproj
│ └── Controllers/
│
├── Business/
│ ├── Business.csproj
│ └── Services/
│
├── DataAccess/
│ ├── DataAccess.csproj
│ └── Repositories/
│
├── Shared/
│ └── Shared.csproj
│
└── Tests/
└── Tests.csprojEach project may contain its own package references and project-to-project dependencies.
Before compiling the application, the required packages must be available.
The traditional workflow often looks like this:
- Start Visual Studio.
- Open the solution.
- Wait for project loading.
- Allow package restoration to run.
- Wait for dependency resolution.
- Start development or compilation.
For a large repository, opening the complete solution may take additional time.
Developers who only need to inspect one project may not want to load every project in the repository.
Visual Studio 2026 improves this workflow by allowing dependency restoration directly from Open Folder.
3. What Is the New Restore Feature in Visual Studio 2026?
Visual Studio 2026 introduces an MSBuild Restore command in Open Folder.
The feature allows developers to right-click a supported solution or project file and select Restore.
Visual Studio executes the MSBuild Restore target through its existing folder-based build-action workflow.
The important advantage is that developers do not need to open a solution before starting the restore operation.
The feature was introduced in the Visual Studio 2026 November update, version 18.12.0.
How the Feature Works
The workflow can be represented as follows:
Start Visual Studio 2026
|
v
Open Repository
|
v
Open Folder
|
v
Locate Project or Solution
|
v
Right-Click File
|
v
Restore
|
v
Execute MSBuild Restore
|
v
Resolve Dependencies
|
v
Generate Restore Assets
|
v
Project Ready to BuildVisual Studio uses the existing build-action workflow associated with the folder.
When a project belongs to a discovered solution, the Restore action preserves the solution-specific targeting.
This is important because some projects depend on properties and configurations defined by their solution context.
Instead of treating the project as an unrelated standalone file, Visual Studio can maintain the appropriate solution context during restoration.
4. Understand Open Folder in Visual Studio 2026
Open Folder allows developers to work directly with a directory instead of immediately loading a solution.
This is useful when a repository contains several solutions, project files, scripts, documentation, and build assets.
For example:
EnterpriseApplication/
│
├── Backend/
│ ├── Backend.sln
│ ├── Api/
│ ├── Services/
│ └── Data/
│
├── Frontend/
│ └── Frontend.sln
│
├── Shared/
│ ├── Shared.csproj
│ └── Common.cs
│
├── Scripts/
│
├── Documentation/
│
└── README.mdA developer may want to inspect the Backend directory without loading every project in the repository.
Open a Folder
Start Visual Studio 2026.
Select:
File → Open → Folder
Choose the repository or project directory.
Visual Studio opens the folder-based workspace.
The files are displayed in the folder view rather than being loaded immediately as a complete solution.
You can browse project files, configuration files, source code, scripts, and other repository content.
Why Use Open Folder?
Open Folder is useful for several development scenarios:
- Inspecting unfamiliar repositories.
- Working with large codebases.
- Reviewing individual project files.
- Exploring repositories containing multiple solutions.
- Editing build scripts.
- Preparing project dependencies.
- Working with source files without loading an entire solution.
The new Restore command extends this workflow by allowing developers to prepare MSBuild dependencies directly from the folder view.
5. Restore Dependencies Without Opening a Solution
Now let's use the new Visual Studio 2026 feature.
Assume you have cloned a repository containing an ASP.NET Core project.
The repository contains:
OrderManagement/
│
├── OrderManagement.sln
│
├── OrderManagement.Api/
│ ├── OrderManagement.Api.csproj
│ └── Program.cs
│
├── OrderManagement.Business/
│ └── OrderManagement.Business.csproj
│
├── OrderManagement.Data/
│ └── OrderManagement.Data.csproj
│
└── OrderManagement.Tests/
└── OrderManagement.Tests.csprojYou want to restore dependencies without opening OrderManagement.sln.
Step 1: Open the Repository Folder
Launch Visual Studio 2026.
Select:
File
|
v
Open
|
v
FolderBrowse to the OrderManagement directory.
Select the folder and open it.
Visual Studio displays the repository contents.
Step 2: Locate the Project File
Find the project you want to restore.
For example:
OrderManagement.Api.csprojThe project file contains the package references and other build information required by MSBuild.
Step 3: Open the Context Menu
Right-click the supported project file.
Visual Studio displays the available project actions.
Step 4: Select Restore
Choose the Restore command from the context menu.
Visual Studio executes the MSBuild Restore target through the folder's existing build-action workflow.
You do not need to open the solution first.
Step 5: Wait for Dependency Restoration
Visual Studio resolves the project's dependencies.
For NuGet-based projects, this can involve:
- Reading PackageReference declarations.
- Evaluating project dependencies.
- Checking configured package sources.
- Resolving package versions.
- Downloading missing packages.
- Generating restore assets.
After a successful restore, the project is prepared for subsequent build operations.
Step 6: Verify the Result
For a project using PackageReference, check the project's obj directory.
You should find:
obj/
|
v
project.assets.jsonThe assets file contains the resolved dependency graph used during compilation.
You can now continue working with the project or open the appropriate solution when you need the complete solution environment.
6. Restore Dependencies From a Solution File
The feature also supports restoring from a supported solution file.
This is useful when a repository contains several solutions and you want to prepare dependencies for one specific solution without opening it.
Consider:
EnterpriseRepository/
│
├── CustomerManagement.sln
├── OrderManagement.sln
├── InventoryManagement.sln
│
├── CustomerManagement/
│ └── CustomerManagement.csproj
│
├── OrderManagement/
│ └── OrderManagement.csproj
│
└── InventoryManagement/
└── InventoryManagement.csprojYou may want to restore only the OrderManagement solution.
Open the repository using Open Folder.
Locate:
OrderManagement.slnRight-click the solution file and select Restore.
Visual Studio executes the restore operation in the context of that solution.
This allows developers to prepare dependencies for a particular application without loading the entire repository into a solution workspace.
Why Solution Context Matters
A project does not always have the same evaluation context when built independently and when built as part of a solution.
For example, a solution may define:
- Shared build configurations.
- Project configuration mappings.
- Conditional project properties.
- Solution-level dependency relationships.
- Repository-specific build settings.
A project can also use imported MSBuild files and properties that affect dependency evaluation.
Visual Studio 2026 preserves solution-specific targeting when the project belongs to a discovered solution.
This helps prevent restore operations from being evaluated in an unintended standalone context.
It is particularly useful for repositories with multiple solutions or projects shared across different applications.
7. Understand How MSBuild Restore Works Internally
To use the feature effectively, developers should understand what MSBuild does during restoration.
MSBuild uses targets to define build operations.
A target is a named collection of tasks that perform a particular operation.
The Restore target is responsible for resolving dependencies before compilation.
For NuGet-based projects, MSBuild invokes the NuGet restore process using the project's evaluated configuration.
The process generally includes the following stages.
Stage 1: Project Evaluation
MSBuild reads the project file and evaluates its properties and items.
For example:
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>The TargetFramework property determines the framework for which the project is being built.
Other properties may come from imported files, environment variables, configuration files, or command-line arguments.
Stage 2: Dependency Discovery
MSBuild identifies the project's package references.
For example:
<ItemGroup>
<PackageReference
Include="Microsoft.Extensions.Http"
Version="10.0.0" />
<PackageReference
Include="Serilog"
Version="4.3.0" />
</ItemGroup>These references describe the packages required by the application.
Stage 3: Dependency Resolution
NuGet resolves the dependency graph.
It checks:
- Direct package references.
- Transitive dependencies.
- Package versions.
- Target framework compatibility.
- Configured package sources.
- Version constraints.
A transitive dependency is a package required by another package rather than being referenced directly by the application.
Stage 4: Package Download
If a required package is not already available in the local package cache, NuGet downloads it from a configured source.
Common sources include:
- NuGet.org.
- Private NuGet feeds.
- Azure Artifacts.
- Organization-managed package repositories.
Stage 5: Generate Restore Assets
For PackageReference projects, NuGet generates the project.assets.json file.
This file contains information about resolved packages, compile-time references, runtime assets, and framework-specific dependencies.
Join the conversation! Your thoughts help the community grow.