mono - How to read Environment variable set by Travis CI in C# -
i've created unit test project requires key not public, locally can read app.config travis ci doesn't have key.
so i've added environment variable in travis ci this:
when travis ci build starts displays variable in log:
setting environment variables repository settings
$ export testkey=testvalue
but according log simple test reads key fails error message key not set environment variable
:
[test] public void testtravisenvvariable() { string testkey= environment.getenvironmentvariable("testkey"); assert.isnotnullorempty(testkey, "key not set environment variable"); }
the environment.getenvironmentvariable
method reads variable of current process., apparently key can't read in case.
so how can read key?
update: not clear me why didn't work in first place sample above works second time ran build.
i tried on travis ci , environment.getenvironmentvariable("testkey");
works fine me in simple console app (specifyingenvironmentvariabletarget.user
or .machine
in overloads doesn't though).