MSBuild Editor is an open-source language service that provides enhanced support for editing MSBuild files in Visual Studio. It includes IntelliSense, Quick Info, validation, code fixes, and refactorings, all driven by a powerful and customizable schema-based type system.
⚠️ The editor is currently in preview.
MSBuild-specific IntelliSense helps you write your project and target files, with rich contextual completion for MSBuild elements, attributes and expressions. The completion for
There's completion for MSBuild expressions, including condition comparisons, property functions and item functions. The editor also supports Expand Selection within MSBuild expressions.
You can use the Go to Definition command or Ctrl-Click to navigate to any import, SDK or filename. If an import has multiple valid ways it can be evaluated, you can navigate to any of them. When navigating to an SDK, you can navigate to any of the
The Find References command can accurately and precisely find all references to items, properties, metadata and tasks throughout your project and its imports, including in expressions.
Quick Info tooltips for items, properties, metadata and values allow you to see their descriptions and expected value types, and see which imports they have been referenced in. Tooltips for imports and SDKs show you the paths of the imported files.
Validation and Analyzers
The editor validates your document against the MSBuild language and any imported schemas, and shows these errors and warnings as you type.
The core validator performs several other diagnostics such as warning about unused symbols, and there is a Roslyn-like analyzer mechanism, and examples of current built-in analyzers include:
Code Fixes and Refactorings
The editor supports code fixes for several diagnostics, and has refactorings such as Extract Expression.
In addition to the schema inferred from the items, metadata, properties and tasks used in a project's imports, the extension also defines a json-based MSBuild-specific schema format that can be used to provide documentation, type annotations, allowed values, and other information that is used to provide a richer editing and validation experience.
Any targets file can provide a schema 'sidecar', which has the same name as the targets file except with the suffix
The extension includes built-in schemas for
The extension resolves your project's imports recursively, and scans all the found MSBuild files for items, properties, metadata, targets and tasks to be included in IntelliSense and Find References. It attempts to resolve imports as broadly as possible so that IntelliSense and navigation are not dependent on the current evaluated state of your project. It ignoring conditions on imports and attempts to evaluate them with multiple property values. It also has full support for SDKs that are resolved via SDK resolvers.
The extension has telemetry that sends anonymized error traces and usage information to the publisher of the extension. This information is used to help improve the extension. The extension's telemetry is enabled when Visual Studio's telemetry is enabled, but you can explicitly opt out. For details, see the full privacy statement.