Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/microsoft/msbuildlocator
An API to locate MSBuild assemblies from an installed Visual Studio location. Use this to ensure that calling the MSBuild API will use the same toolset that a build from Visual Studio or msbuild.exe would.
https://github.com/microsoft/msbuildlocator
msbuild visual-studio
Last synced: 4 days ago
JSON representation
An API to locate MSBuild assemblies from an installed Visual Studio location. Use this to ensure that calling the MSBuild API will use the same toolset that a build from Visual Studio or msbuild.exe would.
- Host: GitHub
- URL: https://github.com/microsoft/msbuildlocator
- Owner: microsoft
- License: other
- Created: 2017-08-18T22:35:08.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-01-27T08:59:52.000Z (24 days ago)
- Last Synced: 2025-02-09T19:01:40.812Z (11 days ago)
- Topics: msbuild, visual-studio
- Language: C#
- Size: 288 KB
- Stars: 227
- Watchers: 20
- Forks: 87
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Microsoft.Build.Locator
## What is Locator for?
MSBuild offers a .NET API surface that allows you to [evaluate](https://docs.microsoft.com/dotnet/api/microsoft.build.evaluation) and [build](https://docs.microsoft.com/dotnet/api/microsoft.build.execution) MSBuild projects from an application. MSBuild is available as a set of NuGet packages that can provide the implementation of the MSBuild programming language to your application. But it's generally not enough to be able to load *some* MSBuild project: you want your application to be able to load the `.csproj`, `.vbproj`, `.fsproj`, `.sqlproj`, `.ccproj` and other project types that you can build in Visual Studio (or Visual Studio Build Tools) or with the .NET SDK. To do that, you need more than just MSBuild's assemblies--you must also have access to all of the SDKs and build logic that are imported into those projects.
That additional build logic is distributed with Visual Studio, with Visual Studio extensions, or as part of the .NET SDK. So to correctly load projects, you need to load them in the context of one of those MSBuild installations.
Loading MSBuild from Visual Studio also ensures that your application gets the same view of projects as `MSBuild.exe`, `dotnet build`, or Visual Studio, including bug fixes, feature additions, and performance improvements that may come from a newer MSBuild release.
## How Locator searches for .NET SDK?
MSBuild.Locator searches for the locally installed SDK based on the following priority:
1. DOTNET_ROOT
2. Current process path if MSBuild.Locator is called from dotnet.exe
3. DOTNET_HOST_PATH
4. DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR
5. PATHNote that probing stops when the first dotnet executable is found among the listed variables.
Documentation describing the definition of these variables can be found here: [.NET Environment Variables](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables).
## Documentation
Documentation is located on the official Microsoft documentation site: [Use Microsoft.Build.Locator](https://docs.microsoft.com/visualstudio/msbuild/updating-an-existing-application#use-microsoftbuildlocator).
## Build status
CI status: 
Official build: [](https://dev.azure.com/dnceng/public/_build/latest?definitionId=80)
## Contributing
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.