I agree with the comments that you should use configuration files or environment variables If you still insist to hard code all your values you could do something like that.
Hard code your variables.
public const string UrlDev = "";
public const string UrlProd = "";
and when you are about to use the url you can do like in your app
var url = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development" ? UrlDev : UrlProd
The Environment variables can be passed to your application on publish like this
dotnet publish /p:Configuration=Release /p:EnvironmentName=Development
The line above will create the following snippet in the csproj file
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Staging" />
</environmentVariables>
So you publish with Environment vairables already attached on the application and then you make a decision which url to use on this variable.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…