The syntax for web.config transformations is something that I have to look up every time I need to use it, so here is a quick reference.
To replace the value an AppSetting value which is declared in the root config (web.config), use the
<add key="MyAppSettingToOverride" value="some value" xdt:Transform="Replace" xdt:Locator="Match(key)" />
IMPORTANT: Both the key itself and the Transform and Locator attributes are case sensitive, so make sure you have the correct casing for the key and that the T and L respectively in Transform and Locator are uppercase.
Removing an AppSetting declared in the root config is done via the
Remove transform (unsurprisingly):
<add key="MyAppSettingToRemove" xdt:Transform="Remove" xdt:Locator="Match(key)" />
The transform for adding new settings which were NOT declared in the root config is
<add key="MyAppSettingToAdd" value="some value" xdt:Transform="Insert" />
IMPORTANT: You have to add the Transform attribute when adding new settings. If you do not include that attribute the setting will not be included in the final configuration file.
To test you configuration, right click the config file you are working on (e.g. web.release.config) and choose