Skip to content

Powershell with /p:ExcludeByFile do not worksΒ #122

@default-writer

Description

@default-writer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions