Microsoft.Build.Locator 1.11.2

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.
133
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
136
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
139
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
142
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
256
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
265
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
138
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
139
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
145
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
147
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
184
Microsoft.VisualStudio.Web.CodeGeneration.Utils
Contains utilities used by ASP.NET Core Code Generation packages.
138
Microsoft.VisualStudio.Web.CodeGeneration.Utils
Contains utilities used by ASP.NET Core Code Generation packages.
140
Microsoft.VisualStudio.Web.CodeGeneration.Utils
Contains utilities used by ASP.NET Core Code Generation packages.
145
Microsoft.VisualStudio.Web.CodeGeneration.Utils
Contains utilities used by ASP.NET Core Code Generation packages.
148
Nuke.Common
Cross-platform build automation system Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit '06168636a6c3d86bc83645fe5ef519ee17bf7233' (see contained AppVeyorSettings.json file for build settings).
152
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).
138
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).
137
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).
138

.NET Framework 4.6

  • No dependencies.

.NET 8.0

  • No dependencies.

Version Downloads Last updated
1.11.2 56 11/27/2025
1.11.1 57 11/20/2025
1.10.12 64 11/09/2025
1.10.2 67 10/04/2025
1.9.1 114 04/02/2025
1.8.1 88 04/02/2025
1.7.8 433 07/22/2024
1.7.1 147 07/22/2024
1.6.10 128 07/22/2024
1.6.1 127 07/22/2024
1.5.32-g4ed1bab6ff 116 07/22/2024
1.5.6 114 07/22/2024
1.5.5 142 07/22/2024
1.5.3 126 07/22/2024
1.4.10-g38d95f4814 140 07/22/2024
1.4.6-g7150a203a1 132 07/22/2024
1.4.1 171 02/04/2024
1.3.2 128 07/22/2024
1.2.15-ge4e3fc36c9 114 07/22/2024
1.2.6 135 07/22/2024
1.2.2 123 07/22/2024
1.1.2 127 07/22/2024
1.0.31 131 07/22/2024
1.0.18 130 07/22/2024
1.0.13 134 07/22/2024
1.0.7-preview-ge60d679b53 144 07/22/2024
1.0.5-preview-gc41880f6f8 106 07/22/2024