You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml" /d:"sonar.verbose=true"
# Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines
dotnet build Twilio.sln > buildsonar.log
dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov
dotnet sonarscanner end /d:sonar.token="${SONAR_TOKEN}"
And were using msbuild for coverage in test.csproj like this
Then i came across this known issue and shifted to use coverlet.collectors. I am using it like this:
dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.login="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml"
# Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines
dotnet build Twilio.sln > buildsonar.log
dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov --collect:"XPlat Code Coverage"
dotnet sonarscanner end /d:sonar.login="${SONAR_TOKEN}"
Error: /home/runner/work/twilio-csharp/twilio-csharp/test/Twilio.Test/Program.cs(9,20): error CS0017: Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point. [/home/runner/work/twilio-csharp/twilio-csharp/test/Twilio.Test/Twilio.Test.csproj]
We have a C# project - https://github.com/twilio/twilio-csharp. We were earlier calculating coverage using these steps:
And were using msbuild for coverage in test.csproj like this
This was giving 0% code coverage like this:
Then i came across this known issue and shifted to use coverlet.collectors. I am using it like this:
My Test.csproj file looks like this now.
Now I am stuck with this error:
Here are the complete logs, if you can see.
I would like to know why is this failing and is there any fix available for msbuild as well? Thanks!
The text was updated successfully, but these errors were encountered: