Evaluation-time validation
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
msbuild doesn't currently have means to report errors during evaluation phase. There are many cases where property definition is making an assumption, e.g. a certain directory exists, but the only way how to enforce such assumption is to add a target that validates it. In some cases that's too late since the property has already been used elsewhere. For example, if the property is used in `````` in a props file. In other cases it is cumbersome to pass the context from the evaluation phase to the target execution phase.
I propose to add an optional ```Requires``` attribute to the property definition element that accepts an expression, similarly to the ```Condition``` attribute. If the expression evaluates to ```false``` the evaluation fails fast with an error message "Property precondition failed.". It would also be useful to add another optional attribute ```ErrorMessage``` that could be used to customize this error message.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.