error MSB4801: The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild
niyatidoshi opened this issue · 1 comments
Hi Guys,
I'm facing below error when I run command "dotnet test.\SampleAPITest.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput="./TestResults/Coverage/" to run test cases.
D:\Projects\VSTS\SampleAPI\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(31,5): error MSB4801: The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild. [D:\Projects\VSTS\SampleAPI\SampleAPI\SampleAPI.csproj]
D:\Projects\VSTS\SampleAPI\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(31,5): error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files\dotnet\sdk\3.1.300\Microsoft.Build.Tasks.Core.dll". The task factory must return a value for the "TaskType" property. [D:\Projects\VSTS\SampleAPI\SampleAPI\SampleAPI.csproj]
Below are the project details:
Projects are based on .Net Framework 4.7.2
- SampleAPI (WebAPI)
- SampleAPI.Test (Test Project)
Project contains reference of "SampleAPI" - to write the test cases of Controller.
Other details:
- To generate code coverage and reports, I've added reference of Coverlet in the test project.
- Added MSBuild.Microsoft.VisualStudio.Web.targets in WebAPI project.
- Already added "RoslynCodeTaskFactory" 2.0.7
Could you please guide me how to resolve the error?
Thanks,
Niyati
It looks like the package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
is using CodeTaskFactory
not RoslynCodeTaskFactory
. Target owners need to update their targets to use the new task.