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.
152
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
160
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
164
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
278
Microsoft.EntityFrameworkCore.Design
Shared design-time components for Entity Framework Core tools.
314
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
151
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
152
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
155
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
158
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
160
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
161
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
165
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
201
Microsoft.VisualStudio.Web.CodeGeneration.Utils
Contains utilities used by ASP.NET Core Code Generation packages.
150
Microsoft.VisualStudio.Web.CodeGeneration.Utils
Contains utilities used by ASP.NET Core Code Generation packages.
155
Microsoft.VisualStudio.Web.CodeGeneration.Utils
Contains utilities used by ASP.NET Core Code Generation packages.
159
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).
169
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).
151
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).
151

.NET Framework 4.6

  • No dependencies.

.NET 8.0

  • No dependencies.

Version Downloads Last updated
1.11.2 73 11/27/2025
1.11.1 72 11/20/2025
1.10.12 76 11/09/2025
1.10.2 79 10/04/2025
1.9.1 125 04/02/2025
1.8.1 99 04/02/2025
1.7.8 453 07/22/2024
1.7.1 159 07/22/2024
1.6.10 139 07/22/2024
1.6.1 138 07/22/2024
1.5.32-g4ed1bab6ff 130 07/22/2024
1.5.6 125 07/22/2024
1.5.5 153 07/22/2024
1.5.3 141 07/22/2024
1.4.10-g38d95f4814 152 07/22/2024
1.4.6-g7150a203a1 139 07/22/2024
1.4.1 181 02/04/2024
1.3.2 147 07/22/2024
1.2.15-ge4e3fc36c9 126 07/22/2024
1.2.6 147 07/22/2024
1.2.2 139 07/22/2024
1.1.2 144 07/22/2024
1.0.31 140 07/22/2024
1.0.18 139 07/22/2024
1.0.13 146 07/22/2024
1.0.7-preview-ge60d679b53 153 07/22/2024
1.0.5-preview-gc41880f6f8 116 07/22/2024