-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Coverlet.MSbuild.Tasks.CoverageResultTask" task was not given a value for the required parameter "InstrumenterState" #480
Comments
I worked around this by combining Traversal SDK and conditional switch. You can use <!-- Coverlet settings -->
<PropertyGroup>
<!-- Enable coverlet by default -->
<EnableCoverlet Condition=" $(EnableCoverlet) == '' AND ($(MSBuildProjectName.ToLower().EndsWith('test')) OR $(MSBuildProjectName.ToLower().EndsWith('tests'))) ">true</EnableCoverlet>
</PropertyGroup>
<ItemGroup Condition=" $(EnableCoverlet) == 'true' ">
<PackageReference Include="coverlet.msbuild" Version="2.6.2" />
</ItemGroup> |
@yhvicey thanks for your response, any chance you could send me an example including the traversal snippet? |
Imaging we have a project folder like below:
Your first <Project Sdk="Microsoft.Build.Traversal">
<ItemGroup>
<ProjectReference Include="src\dirs.proj" />
<ProjectReference Include="test\dirs.proj" />
</ItemGroup>
</Project> Your second <Project Sdk="Microsoft.Build.Traversal">
<ItemGroup>
<ProjectReference Include="TestProject/TestProject.csproj" />
<!-- Other projects -->
</ItemGroup>
</Project> Note: Use global.json to specify versions for those SDKs globally, otherwise you will have to specify them like {
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "1.0.73",
"Microsoft.Build.Traversal": "2.0.12"
}
}
And you can use this pattern recursively. I guess the root cause here is this coverlet version (2.6.2 in my case) cannot handle non-test project properly, so we have to avoid making coverlet available for those non-test projects, like your root project. By using traversal, you can make Besides, I doubt this might be caused by your property. |
thank's @yhvicey for help! |
for the record, I've faced the same error, and I've realized that I've had added coverlet nuget to business projects. When I removed it, it's been fixed. |
in my case after getting that error, I've installed MS.Net.Test.Sdk which cleared the error so in my test project package I do have < |
@farhad-taran-cko any news? |
Close for stale discussion. |
I have an open source project in GitHub, and we have problem to reporting testing result from issue Romanx/Cake.Coverlet#30 , we install Coverlet.MSBuild to Test project, but we got this error in appveyor . Did you can any help, please reopen this issue @MarcoRossignoli |
@soroshsabz seem not related to coverlet I did some test with your project you need to update some ref to run nunit test with run
|
Thanks you very much :) @MarcoRossignoli |
You're welcome! |
Ah @soroshsabz if you can use vstest integration that is better than msbuild https://github.com/tonerdo/coverlet#vstest-integration-preferred-due-to-know-issue if you're in trouble let me know. |
Adding a package reference in a non-test project would lead to this error when running `dotnet test` in the repository root: > ~/.nuget/packages/coverlet.msbuild/3.0.3/build/coverlet.msbuild.targets(70,5): error MSB4044: The "Coverlet.MSbuild.Tasks.CoverageResultTask" task was not given a value for the required parameter "InstrumenterState". See coverlet-coverage/coverlet#480 (comment) Also delete the workaround for the bug in generation of _LocalTopLevelSourceRoot which is [no longer necessary](coverlet-coverage/coverlet#863).
Hello,
I have setup a post build event in my shared test library, this library has not tests but is referenced by all my test projects, I did this because I want to automatically generate the reports every-time the projects are built.
however I am getting the following error when I try to build the solution and the build hangs:
C:\...\packages\coverlet.msbuild\2.6.2\build\coverlet.msbuild.targets(41,5): error MSB4044: The "Coverlet.MSbuild.Tasks.CoverageResultTask" task was not given a value for the required parameter "InstrumenterState".
Directory.Build.Props
`
`
Directory.Build.Targets
`
`
The text was updated successfully, but these errors were encountered: