I need to read environment variables from app.config file using shell script and need to set in constant.cs file.
Here is link which I am following :
I have app.config file from xamarin.form in following format :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
    <add key="appId" value="12974" />
    <add key="url" value="https://abc.xyz.com" />
</appSettings>
Here is code which I am using to read config.file and set to constant.cs file. But I ma not sure which one will work.
if [ -e "$APP_CONSTANT_FILE" ]
then
    if [ -e "$ENV_FILE" ]
    then
        echo "Both Config files are available"
        #name=applicationID
        #$ awk -F\" -v n="$name" '/<ATTRIBUTE NAME="/ && $2==n {print $4}' data 
        #awk -F"\"" ' /AppId/ {print $4}' = -F"\"" ' /appID/ {print $4}' $APP_CONSTANT_FILE $ENV_FILE
        awk 'FNR==NR{a[FNR]=$0;next}{$NF=gensub(/value=".*"\/>/,"value=\""a[FNR]"\"\/>","g",$NF);print}' $APP_CONSTANT_FILE $ENV_FILE
        #sed -i '' 's#ApiUrl = "[-A-Za-z0-9:_./]*"#ApiUrl = "'$API_URL'"#' $APP_CONSTANT_FILE
        echo "File content:"
        cat $APP_CONSTANT_FILE
    else
        echo "Can not locate $ENV_FILE file"
        exit
    fi
else
    echo "Can not locate $APP_CONSTANT_FILE file"
    exit
fi
Please provide me reference or hint to read value by key and set it to .cs file
 
     
    