question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Powershell with /p:ExcludeByFile do not works

See original GitHub issue

Powershell script By adding command /p:ExcludeByFile=\"**/MyFun*.cs,**/*Test*.cs,**/*Exception*.cs,**/*Attribute*.cs\" to

& dotnet test --configuration Release --no-build Build.Tests /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

I manage to break generation of the report file, if I removes /p:ExcludeByFile=\"...\" everything works I tried with no success:


/p:ExcludeByFile=\"**/MyFun*.cs,**/*Test*.cs,**/*Exception*.cs,**/*Attribute*.cs\"
/p:ExcludeByFile="**/MyFun*.cs,**/*Test*.cs,**/*Exception*.cs,**/*Attribute*.cs"
/p:ExcludeByFile=\"**\/MyFun*.cs,**\/*Test*.cs,**\/*Exception*.cs,**\/*Attribute*.cs\"
/p:ExcludeByFile=\"**\MyFun*.cs,**\*Test*.cs,**\*Exception*.cs,**\*Attribute*.cs\"
/p:ExcludeByFile="**\MyFun*.cs,**\*Test*.cs,**\*Exception*.cs,**\*Attribute*.cs"

/p:ExcludeByFile just not works

https://ci.appveyor.com/project/hack2root/build/build/1.0.0.222-master https://ci.appveyor.com/project/hack2root/build/build/1.0.0.223-master

Why not to use SonarScanner format

/d:sonar.coverage.exclusions="**/MyFun*.cs,**/*Test*.cs,**/*Exception*.cs,**/*Attribute*.cs"

for /p:ExcludeByFile, for example:

/p:ExcludeByFile="**/MyFun*.cs,**/*Test*.cs,**/*Exception*.cs,**/*Attribute*.cs"

My build script:

& packages/dotnet-sonarscanner begin /d:sonar.login="$env:SONARCLOUDTOKEN" /k:"build-core" /d:sonar.host.url="https://sonarcloud.io" /n:"build" /v:"1.0" /d:sonar.cs.opencover.reportsPaths="Build.Tests/coverage.opencover.xml" /d:sonar.coverage.exclusions="**/MyFun*.cs,**/*Test*.cs,**/*Exception*.cs,**/*Attribute*.cs" /d:sonar.organization="hack2root-github" /d:sonar.sourceEncoding="UTF-8"
& dotnet build --configuration Release
& dotnet test --configuration Release --no-build Build.Tests /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
& packages/dotnet-sonarscanner end /d:sonar.login="$env:SONARCLOUDTOKEN"
& packages/csmacnz.Coveralls --opencover -i Build.Tests/coverage.opencover.xml

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
SlowLogicBoycommented, Nov 6, 2018

@tonerdo Files didn’t get excluded, tried various patterns for these. Exclude doesn’t work also.

0reactions
stanislav-trifancommented, Jul 26, 2021

still not working on .net 3.1.411

Read more comments on GitHub >

github_iconTop Results From Across the Web

Powershell with /p:ExcludeByFile do not works · Issue #122
So what am I supposed to do if I want to exclude some Migrations folder? Something like dotnet test Code /p:CollectCoverage=true /p: ...
Read more >
Exclude list in PowerShell Copy-Item does not appear to ...
I have found that -Include and -Exclude do not work right for Select-String, Copy-Item, and some other commands. It does work right for...
Read more >
dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given project.
Read more >
Code coverage with Coverlet in MSBuild and Azure Pipelines
Enabling code coverage is as simple as setting the CollectCoverage property to true . > dotnet test /p:CollectCoverage=true. Add Coverlet to the ...
Read more >
Pester.psm1 5.3.0-rc1
Write-PesterDebugMessage -Scope Runtime "Running test '$($Test.Name)'." } # no callbacks are provided because we are not transitioning between any states
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found