coverlet: Multiple Excludes don't work in Powershell

I am trying to exclude multiple things but always getting an error when executing it in powershell:

dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput="..\lcov.info" /p:Exclude="[*]*Examples?,[*]*Startup"

Also tried this but no luck either:

dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput="..\lcov.info" /p:Exclude=\"[*]*Examples?,[*]*Startup\"

Am I doing something wrong or is this a bug?

The response is in both cases. If used alone both of them work just fine.

MSBUILD : error MSB1006: Property is not valid.
Switch: [*]*Startup

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 15

Most upvoted comments

Hey guys, I’ve fiddled with this a bit and from https://github.com/Microsoft/msbuild/issues/471#issuecomment-366268743 the definitive way to fix this issue is to use %2c as the separator which msbuild will translate to ,

/p:Exclude="[*]*Examples?%2c[*]*Startup"

This should do the trick for all Powershell related property parsing errors. Looking for a contributor to help add this to the README

Try this. Same as @tonerdo 's suggestion, but with single quotes and include escaped double quote '/p:Exclude=\"[*]*Examples?,[*]*Startup\"'

I stumbled upon the same issue when executing in an docker environment (microsoft/dotnet:latest) with .NET core. %2C works as a workaround.

Created PR #191 regarding this issue