Open stan-sz opened 1 year ago
If new options -evaluateProperty:name=value
and -evaluateRestoreProperty:name=value
were added, then it would be possible to request evaluation separately for each property.
The MSBuild task that can be executed from targets does not need any changes here, I think.
Team triage: Could you please give us an example of how you would use this and an expected output?
Example: -evaluateProperty:BuildStartTime="$([System.DateTime]::Now.ToString('yyyyMMdd-HHmmss'))"
could resolve the property to a datetime string.
Team triage: let's collect interest in this feature. fyi @baronfel
Folks that use the containers tooling have demonstrated a similar use case. In their CI/CD script's they'll generate an unique tag for the image by using some other program (for example the date
command available in most unix systems) and then they'll use the value of that as part of a -property:ContainerImageTag={{ env.DATE }}
kind of variable interpolation inside of GitHub actions.
This is attractive to me for that reason, but I agree with collecting more user use cases.
Per https://github.com/dotnet/msbuild/issues/7357#issuecomment-1344403099 can MSBuild have an opt-in mechanism to evaluate property functions passed both as command line args or through .rsp file? Possibly the opt-in mechanism could be through https://github.com/dotnet/msbuild/blob/07bf358dd7fa5037747a040f5e792d9dd82129aa/documentation/wiki/MSBuild-Tips-%26-Tricks.md#environment-variables (similar to the flag for allowing all property functions be used) or through a dedicated
/evaluateGlobalPropertyFunctions