I have a appsettings.json file in my dotnet core project. From Teamcity I need to update the content of the file. File looks something like this
{
"keyofjson":"valuetobeupdated"
}
I need to update the text "valuetobeupdated" based on "keyofjson". In traditional .net projects we had .config file which could be updated using msbuild file based using the target from xmlpeek and xmlpoke tasks. Do we have something same in dotnet core?
In step build use PowerShell script:
$filePath = "yourPath"
(GC $filePath).Replace("valuetobeupdated", "keyofjson") | Set-Content $filePath