| title | MSB4062 diagnostic code | ||||
|---|---|---|---|---|---|
| description | Learn about the possible causes of the MSB4062 build error and get troubleshooting tips. | ||||
| ms.date | 05/16/2025 | ||||
| ms.topic | error-reference | ||||
| f1_keywords |
|
||||
| dev_langs |
|
||||
| author | ghogen | ||||
| ms.author | ghogen | ||||
| ms.subservice | msbuild |
This article describes the MSB4062 error code.
MSB4062: The 'value' task could not be loaded from the assembly 'value'. 'value' Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
This error is emitted when MSBuild can't load a task assembly before executing the task.
Error MSB4062 might be caused when a task runs in an environment for which it isn't prepared. For example, when a task assembly targets 32-bit x86 but it runs in a 64-bit MSBuild environment.
S:\BitnessInMSBuild\ShowErrors.proj(13,5): error MSB4062: The "TaskCompiledForx86" task could not be loaded from the assembly S:\BitnessInMSBuild\TaskCompiledForx86\bin\Debug\net472\TaskCompiledForx86.dll. Could not load file or assembly 'file:///S:\BitnessInMSBuild\TaskCompiledForx86\bin\Debug\net472\TaskCompiledForx86.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Ensure the task expresses a dependency on the runtime environment it requires in the task's UsingTask element.
All versions of MSBuild