In SlowCheetah, I would like to transform some elements of my config file not with hard-coded values in a transform file, but either with the contents of another file or (preferably) a value generated from code. For example, in the case of generating a value from code, instead of this:
{
"someSettings": {
"@jdt.replace": {
"timeTokenAtBuild": "1f3ac2"
}
}
}
... I want something like this:
{
"someSettings": {
"@jdt.replace": {
"timeTokenAtBuild": [MyUtilitiesLibrary.GetCurrentTimeToken()]
}
}
}
Getting the value from something like a PowerShell script would be fine too. Can I do this with SlowCheetah currently? If not how hard would it be to extend it to allow this functionality?
Alternatively, is there some other NuGet package or msbuild mechanism I can use to achieve this behaviour?
Not know about SlowCheetah. But for MSBuild, you can define a custom replace task to do that:
Then you can use this task to replace elements of config file:
Note, since the replace value is generated from code, you may need use PowerShell script or other scripts to set value for msbuild property:
How to set value for msbuild property using powershell?
Hope this helps.