Edit

Share via


MSB4801 diagnostic code

This article describes the MSB4801 error code.

Message text

MSB4801: The task factory 'task-factory' is not supported on the .NET Core version of MSBuild.

Description

This error usually occurs when you're targeting .NET Core or .NET or later, but a task was provided the CodeTaskFactory for the TaskFactory parameter in a UsingTask element. Every task has a task factory, which is used by MSBuild to instantiate and launch the task. For code-based tasks, .NET Framework can use the CodeTaskFactory, but .NET Core requires RoslynCodeTaskFactory.

For more information, see RoslynCodeTaskFactory.

Resolution

When you're targeting .NET Core or .NET 5 and later, you must use RoslynCodeTaskFactory instead of CodeTaskFactory. Note that RoslynCodeTaskFactory also works for .NET Framework, so you can safely update any references to CodeTaskFactory to RoslynCodeTaskFactory regardless of target framework.

Applies to

All versions of MSBuild