dotnet / dotnet/templating

Duplication of custom operations

Open
#1,775 6 comments 3 reactions 0 assignees View on GitHub
area: authoring feature Priority:2 triage:transfer-to-sdk triaged
Dominant language
No language data
Stars
1.7k
Forks
399
Avg merge
3d 5h
Merged PRs (30d)
39

Description

First of all, neither `CustomOperations` nor `SpecialCustomOperations` are included in the json schema, which results in no Intellisense support in VS 2017, and makes them hard to work with.

We need to use conditional processing for XML content in various template files, but, while it works fine for our *proj files, it does not work for .config files out of the box. We had to add special operations for .config files to enable it as follows.
```
"SpecialCustomOperations": {
"**/*.config": {
"operations": [
{
"type": "conditional",
"configuration": {
"actionableIf": [ "",
"pseudoEndToken": "-- >",
"id": "fixPseudoNestedComments",
"resetFlag": "_TestResetFlag_"
}
}
]
},...
```
However, we also have other files that contain XML with a different extension (`*.xom`). So, to enable conditional processing for those as well, we had to repeat the same configuration for the `**/*.xom` pattern, since I don't know how to specify the glob to cover multiple extensions. This results in unnecessary duplication, and bloats the template configuration.

It would be great if the operations could be defined separately under a unique name, and then just referenced by the special custom operations under the respective globs. In this case we would just reference the standard operation to apply it to any additional extensions. Please let me know if there is a better way to define such conditional processing without duplicating configurations.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.