A few hours after writing the last post, I discovered that one can specify environment variables in the .csdef file:
<Runtime><Environment><Variablename="a"value="b"/></Environment></Runtime>
Don't know yet, if this does the same as my code in the last post. I might investigate on that...