I am using .NET Core 6.0.100 and MS Visual Studio Community 2022 17.0.2
I develop a terminal app that uses target's MAC and IP addresses as an input. As it is meant to be an open source project (repo is not public yet) I'd like to avoid publishing my MAC address that I use while testing it, inside launchSettings.json
while pushing to repo. I thought of using environment variable instead of hardcoding it.
Is it possible and sensible to refer to environment variable's value inside launchSettings.json
without implementing additional logic inside a program or should I utilize .gitignore
filters / some other solution?
Currently this is how my launchSettings.json
looks (MAC Address shown is random of course):
{
"profiles": {
"ProgramName": {
"commandName": "Project",
"commandLineArgs": "BC:34:2B:4C:AB:BE 192.168.0.12"
}
}
}
I tried passing command arguments as a value of environment variable "commandLineArgs": "$COMMAND_PARAMETERS"
inside launchSettings.json
but it is recognized as plain text instead of environment variable and so value: "$COMMAND_PARAMETERS"
is passed as args[0]
.