Skip to content

Contributing to built in schemas

Mikayla Hutchinson edited this page Apr 19, 2024 · 3 revisions

The MSBuild Editor extension ships with built-in schemas for well-known targets/props files that do not currently ship their own sidecar schemas. These schemas are maintained in the MonoDevelop.MSBuildEditor/Schemas directory.

In the long term the built-in schemas should be converted into sidecar schemas and maintained and shipped alongside the targets/props files that they describe. However, for now they are necessary for the MSBuild Editor to provide a good IntelliSense and validation experience.

Editing Built-in Schemas

To edit a built-in schema, find that schema in the MonoDevelop.MSBuildEditor/Schemas directory and open it.

For details of the .buildschema.json schema format, see Schema Structure.

Visual Studio Code is the recommended JSON editor for .buildschema.json files, as it provides validation and IntelliSense for JSON pointers, and fully supports draft-07 schema features. The MonoDevelop.MSBuildEditor repository is configured with a .vscode/settings.json file that associates the .buildschema.json JSON schema with *.buildschema.json files, so you will get IntelliSense and validation without needing to manually associate the schema.

However, editing .buildschema.json files in Visual Studio is fully supported and is useful for quick edits when working on the MonoDevelop.MSBuild solution. For details, see Using the JSON Schema.

After editing .buildschema.json files, be sure to run the tests in the MonoDevelop.MSBuildEditor.Tests project to ensure that the schemas is valid. If the schemas are not valid, the CI actions on the repository will prevent merging the pull request.

Adding a New Built-in Schema

To add a new built-in schema, follow these steps:

  1. Add a new schema file to the MonoDevelop.MSBuildEditor/Schemas directory.
  2. Add the name of the new schema file to the BuiltInSchemaId enum (without the .buildschema.json extension) .
  3. Add the new BuiltInSchemaId value to the built-in schema filename map to associate it with a filename and optional MSBuild SDK ID.

Clone this wiki locally