2

In Rust you can inspect environment variables at compile time like so:

let sha: Option<&'static str> = option_env!("CI_COMMIT_SHA");
println!("CI_COMMIT_SHA: {:?}", sha);

Is this possible now C# too, or do I really have to sed-replace the source file during the build process like back in the old days?

Is there a convenient way to evaluate environment variables during compile time in netcore/.NET5/C#9 or later nowadays?

mbx
  • 6,292
  • 6
  • 58
  • 91

0 Answers0