Microsoft.Build.Locator 1.11.1

Prefix Reserved
dotnet add package Microsoft.Build.Locator --version 1.11.1
                    
NuGet\Install-Package Microsoft.Build.Locator -Version 1.11.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Build.Locator" Version="1.11.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Build.Locator" Version="1.11.1" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Build.Locator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.Build.Locator --version 1.11.1
                    
#r "nuget: Microsoft.Build.Locator, 1.11.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.Build.Locator@1.11.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.Build.Locator&version=1.11.1
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Build.Locator&version=1.11.1
                    
Install as a Cake Tool

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.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (82)

Showing the top 5 NuGet packages that depend on Microsoft.Build.Locator:

Package Downloads
Microsoft.VisualStudio.Web.CodeGenerators.Mvc

Code Generators for ASP.NET Core MVC. Contains code generators for MVC Controllers and Views.

Microsoft.VisualStudio.Web.CodeGeneration.Design

Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.

Microsoft.VisualStudio.Web.CodeGeneration

Contains the CodeGenCommand that finds the appropriate code generator and invokes it from project dependencies.

Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore

Contains Entity Framework Core Services used by ASP.NET Core Code Generators.

Nuke.ProjectModel

The AKEless Build System for C#/.NET Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit 'a20c3b752d0c9f533a6e2c21fee6325032cd3d70' (see contained AppVeyorSettings.json file for build settings).

GitHub repositories (91)

Showing the top 20 popular GitHub repositories that depend on Microsoft.Build.Locator:

Repository Stars
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
stride3d/stride
Stride (formerly Xenko), a free and open-source cross-platform C# game engine.
xamarin/Xamarin.Forms
Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
dotnet/tye
Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.
tModLoader/tModLoader
A mod to make and play Terraria mods. Supports Terraria 1.4 (and earlier) installations
dotnet/Silk.NET
The high-speed OpenGL, OpenCL, OpenAL, OpenXR, GLFW, SDL, Vulkan, Assimp, WebGPU, and DirectX bindings library your mother warned you about.
grpc/grpc-dotnet
gRPC for .NET
riok/mapperly
A .NET source generator for generating object mappings. No runtime reflection.
scriban/scriban
A fast, powerful, safe and lightweight scripting language and engine for .NET
dotnet/samples
Sample code referenced by the .NET documentation
nuke-build/nuke
🏗 The AKEless Build System for C#/.NET
dotnet/roslynator
Roslynator is a set of code analysis tools for C#, powered by Roslyn.
waf/CSharpRepl
A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
dafny-lang/dafny
Dafny is a verification-aware programming language
martinothamar/Mediator
A high performance implementation of Mediator pattern in .NET using source generators.
coverlet-coverage/coverlet
Cross platform code coverage for .NET
dotnet/sdk
Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
mono/monodevelop
MonoDevelop is a cross platform .NET IDE
DotNetAnalyzers/StyleCopAnalyzers
An implementation of StyleCop rules using the .NET Compiler Platform
EWSoftware/SHFB
Sandcastle Help File Builder (SHFB). A standalone GUI, Visual Studio integration package, and MSBuild tasks providing full configuration and extensibility for building help files with the Sandcastle tools.
Version Downloads Last Updated
1.11.1 956 11/18/2025
1.10.12 13,893 11/6/2025
1.10.2 61,550 10/4/2025
1.9.1 520,407 3/31/2025
1.8.1 4,844 3/31/2025
1.7.8 54,256,632 3/14/2024
1.7.1 237,980 2/6/2024
1.6.10 3,432,032 9/20/2023
1.6.1 96,475 8/30/2023
1.5.32-g4ed1bab6ff 597 8/25/2023
1.5.6 10,389 8/29/2023
1.5.5 3,472,654 9/6/2022
1.5.3 82,036 8/11/2022
1.4.10-g38d95f4814 1,227 8/8/2022
1.4.6-g7150a203a1 890 8/5/2022
1.4.1 35,692,400 1/21/2021
1.3.2 60,576 12/17/2020
1.2.15-ge4e3fc36c9 1,399 11/9/2020
1.2.6 2,114,939 8/14/2019
1.2.2 377,547 4/3/2019
1.1.2 149,886 12/7/2018
1.0.31 74,313 9/12/2018
1.0.18 60,958 5/29/2018
1.0.13 130,823 4/5/2018
1.0.7-preview-ge60d679b53 3,008 2/22/2018
1.0.5-preview-gc41880f6f8 1,750 2/15/2018