MSB4175: The task factory 'task-factory-name' could not be loaded from the assembly 'assembly-name'

This error occurs when MSBuild encounters a problem during the creation of a task using a task factory.

When MSBuild processes a UsingTask, a task factory builds an instance of a task that is then invoked. Typically, an assembly or DLL is used, but the task might also be created dynamically from code, as in the case of CodeTaskFactory and RoslynTaskFactory, or from XAML, as in the case of XamlTaskFactory. A second error might give more information on the cause of the failure. Common reasons for this error include:

  • The task assembly couldn't be loaded. Check the path and permissions on the file.
  • There's a coding error in the code used to dynamically create the task. The compiler error will be shown in a second error.