Using environment variables in dotCover CoverageParams xml file


I'm using dotCover 2016.3.1 command line version to generate code coverage reports. I'm passing all my parameters (including a long list of filters) by putting them all inside an xml file.

I set some environment variables to determine if my app is being built for x86/x64 and Debug/Release so the value of parameters inside the XML file (such as TargetArguments and TargetWorkingDir) would have to be determined at runtime by reading these environment variables.

Is there a way to tell dotCover to read these environment variables when parsing the XML file? For example in Visual Studio you can use $(SomeVariable) but that does not work in dotCover. When I run "dotCover.exe cover MyParams.xml" I see that $(SomeVariable) is not resolved to its value.

Comment actions Permalink

I didn't realize that you can call dotCover.exe with a mix of params that come from command line and XML file.

So I figured out a workaround. I use a batch file to call dot cover and for params that need to get their values from environment variables I specify them in the batch file. But for filters I specify them in the XML file (since I have a lot of filters and managing them in an XML file is neater).

So the call would be something like: dotCover.exe cover /TargetArguments="%MyVariable%" MyOtherParams.xml

It would still be nice to be able to use environment variable directly in the XML file though.

Comment actions Permalink

Hi Meisam,

Great it works fine for you now!
I've opened a feature request:, you are welcome to follow and vote for it.


Please sign in to leave a comment.