Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 2.44 KB

File metadata and controls

50 lines (38 loc) · 2.44 KB
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
MSB4062
MSBuild.TaskLoadFailure
dev_langs
VB
CSharp
C++
FSharp
author ghogen
ms.author ghogen
ms.subservice msbuild

MSB4062 diagnostic code

This article describes the MSB4062 error code.

Message text

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.

Description

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.

Resolution

Ensure the task expresses a dependency on the runtime environment it requires in the task's UsingTask element.

Applies to

All versions of MSBuild