https://github.com/devlooped/yaml
YamlPeek MSBuild Task
https://github.com/devlooped/yaml
dotnet msbuild yaml yml
Last synced: 8 months ago
JSON representation
YamlPeek MSBuild Task
- Host: GitHub
- URL: https://github.com/devlooped/yaml
- Owner: devlooped
- License: mit
- Created: 2021-09-15T11:43:22.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-07T14:11:21.000Z (over 1 year ago)
- Last Synced: 2025-02-07T15:20:02.926Z (over 1 year ago)
- Topics: dotnet, msbuild, yaml, yml
- Language: C#
- Homepage: https://clarius.org/yaml
- Size: 91.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Contributing: .github/contributing.md
- Funding: .github/FUNDING.yml
- License: license.txt
- Code of conduct: .github/code_of_conduct.md
- Security: .github/security.md
- Support: .github/support.md
Awesome Lists containing this project
README
 YamlPeek MSBuild Task
============
[](https://www.nuget.org/packages/YamlPeek)
[](https://www.nuget.org/packages/YamlPeek)
[](https://github.com/devlooped/yaml/blob/main/license.txt)
[](https://github.com/devlooped/yaml/actions)
Read values from yaml files using JSONPath query expressions.
Usage:
```xml
```
Parameters:
| Parameter | Description |
| ----------- | -------------------------------------------------------------------------------------------------------------- |
| Content | Optional `string` parameter.
Specifies the YAML input as a string. |
| ContentPath | Optional `ITaskItem` parameter.
Specifies the YAML input as a file path. |
| Query | Required `string` parameter.
Specifies the [JSONPath](https://goessner.net/articles/JsonPath/) expression. |
| Result | Output `ITaskItem[]` parameter.
Contains the results that are returned by the task. |
You can either provide the path to a YAML file via `ContentPath` or
provide the straight YAML content to `Content`. The `Query` is a
[JSONPath](https://goessner.net/articles/JsonPath/) expression that is evaluated
and returned via the `Result` task parameter. You can assign the resulting
value to either a property (i.e. for a single value) or an item name (i.e.
for multiple results).
YAML object properties are automatically projected as item metadata when
assigning the resulting value to an item. For example, given the following JSON:
```yaml
http:
host: localhost
port: 80
ssl: true
```
You can read the entire `http` value as an item with each property as a metadata
value with:
```xml
```
The `Http` item will have the following values (if it were declared in MSBuild):
```xml
localhost
80
true
```
These item metadata values could be read as MSBuild properties as follows, for example:
```xml
@(Http -> '%(host)')
@(Http -> '%(port)')
@(Http -> '%(ssl)')
```
In addition to the explicitly opted in object properties, the entire node is available
as raw YAML via the special `_` (single underscore) metadata item.