Provides current configuration value at build time that can be utilized for changing test environment for automation testing. The value is the current configuration dropdown value or the configuration variable.
Requires .NetFramework 4.5 or higher or any version of .NetCore
If you have Debug
, Release
, Staging
in the configuration dropdown, then select Staging
. Then build the project. Then do
string stagingConfigName = ActiveConfiguration.Value;
If you're on .NetFramework, make sure your custom configuration is available for the project. See Configuration Manager