Microsoft.Build.Locator 1.11.1
Microsoft.Build.Locator
Microsoft.Build.Locator helps you locate and register MSBuild assemblies provided with Visual Studio or the .NET SDK. This is essential when you need to use MSBuild APIs in your application to evaluate or build projects.
Why do I need this?
When using MSBuild's .NET API to load and build projects, you need access to the SDKs and build logic distributed with Visual Studio or the .NET SDK, not just the MSBuild APIs. MSBuildLocator helps you find these installations and set up your application to use them, ensuring your code gets the same view of projects as MSBuild.exe, dotnet build, or Visual Studio.
Quick Start
Before using any MSBuild APIs, register MSBuild assemblies:
using Microsoft.Build.Locator;
using Microsoft.Build.Evaluation;
// Register defaults before using any MSBuild types
MSBuildLocator.RegisterDefaults();
// Now you can safely use MSBuild APIs.
// NOTE: due the the way that the CLR loads assemblies, you MUST
// register MSBuild through Locator before any types from
// the MSBuild assemblies are used in your application.
// The safest way to ensure this is to put any MSBuild API
// access into a separate method.
LoadProject();
void LoadProject()
{
var project = new Project("MyProject.csproj");
...
}
For more control over which MSBuild instance to use:
using Microsoft.Build.Locator;
// Query available MSBuild instances
var instances = MSBuildLocator.QueryVisualStudioInstances().ToArray();
// Register a specific instance
var instance = instances.OrderByDescending(i => i.Version).First();
MSBuildLocator.RegisterInstance(instance);
Documentation
For complete documentation, see Use Microsoft.Build.Locator on Microsoft Learn.
Samples
See the BuilderApp sample for a full exploration of the MSBuildLocator library and capabilities.
Showing the top 20 packages that depend on Microsoft.Build.Locator.
| Packages | Downloads |
|---|---|
|
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
|
92 |
|
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
|
93 |
|
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
|
97 |
|
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
|
189 |
|
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
|
91 |
|
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
|
94 |
|
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
|
96 |
|
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
|
144 |
|
Microsoft.VisualStudio.Web.CodeGeneration.Utils
Contains utilities used by ASP.NET Core Code Generation packages.
|
89 |
|
Microsoft.VisualStudio.Web.CodeGeneration.Utils
Contains utilities used by ASP.NET Core Code Generation packages.
|
96 |
|
Nuke.Common
Cross-platform build automation system
Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit '12a091bbe2dc56bb3a2db64178dfc5305d769b3b' (see contained AppVeyorSettings.json file for build settings).
|
89 |
|
Nuke.Common
Cross-platform build automation system
Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit '706f53a42a3ab7ee112350cfdd0e4d1683eb5d1d' (see contained AppVeyorSettings.json file for build settings).
|
88 |
|
Nuke.Common
Cross-platform build automation system
Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit 'fa8aae50ade3b7479a059fcd775fd4dc1a108220' (see contained AppVeyorSettings.json file for build settings).
|
89 |
|
Nuke.ProjectModel
Cross-platform build automation system
Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit '4667694d0480c8fc8fcc027d7dab8566d3f4dfcd' (see contained AppVeyorSettings.json file for build settings).
|
97 |
|
Nuke.ProjectModel
The AKEless Build System for C#/.NET
Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit '011956b31c05f14f3233f6241cd6fbe038824d71' (see contained AppVeyorSettings.json file for build settings).
|
95 |
|
Nuke.ProjectModel
The AKEless Build System for C#/.NET
Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit 'aeacff85068cb9218354491b39fbf916e5ea28e8' (see contained AppVeyorSettings.json file for build settings).
|
91 |
|
Nuke.ProjectModel
The AKEless Build System for C#/.NET
Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit 'bbceff250ec4c9c604b33b38600ab9b4a4e17dac' (see contained AppVeyorSettings.json file for build settings).
|
90 |
|
Nuke.ProjectModel
The AKEless Build System for C#/.NET
Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit 'cda28e5941e47b2b2a3d9bea20f78d11af1d92e0' (see contained AppVeyorSettings.json file for build settings).
|
88 |
|
Nuke.ProjectModel
The AKEless Build System for C#/.NET
Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit 'ea86450b4db1568563b15122f0250495fd55776e' (see contained AppVeyorSettings.json file for build settings).
|
89 |
.NET Framework 4.6
- No dependencies.
.NET 8.0
- No dependencies.
| Version | Downloads | Last updated |
|---|---|---|
| 1.11.1 | 2 | 11/20/2025 |
| 1.10.12 | 11 | 11/09/2025 |
| 1.10.2 | 27 | 10/04/2025 |
| 1.9.1 | 70 | 04/02/2025 |
| 1.8.1 | 52 | 04/02/2025 |
| 1.7.8 | 249 | 07/22/2024 |
| 1.7.1 | 86 | 07/22/2024 |
| 1.6.10 | 86 | 07/22/2024 |
| 1.6.1 | 89 | 07/22/2024 |
| 1.5.32-g4ed1bab6ff | 78 | 07/22/2024 |
| 1.5.6 | 77 | 07/22/2024 |
| 1.5.5 | 99 | 07/22/2024 |
| 1.5.3 | 80 | 07/22/2024 |
| 1.4.10-g38d95f4814 | 97 | 07/22/2024 |
| 1.4.6-g7150a203a1 | 74 | 07/22/2024 |
| 1.4.1 | 129 | 02/04/2024 |
| 1.3.2 | 89 | 07/22/2024 |
| 1.2.15-ge4e3fc36c9 | 78 | 07/22/2024 |
| 1.2.6 | 90 | 07/22/2024 |
| 1.2.2 | 82 | 07/22/2024 |
| 1.1.2 | 88 | 07/22/2024 |
| 1.0.31 | 89 | 07/22/2024 |
| 1.0.18 | 75 | 07/22/2024 |
| 1.0.13 | 74 | 07/22/2024 |
| 1.0.7-preview-ge60d679b53 | 78 | 07/22/2024 |
| 1.0.5-preview-gc41880f6f8 | 71 | 07/22/2024 |