本文介绍MSB4062错误代码。
消息文本
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
当 MSBuild 在执行任务之前无法加载任务程序集时,将发出此错误。
当任务在一个不适合运行的环境中执行时,可能会导致错误MSB4062。 例如,当任务程序集面向 32 位 x86,但它在 64 位 MSBuild 环境中运行。
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.
决议
确保任务在任务的 UsingTask 元素中表示它所需的运行时环境依赖项。
适用于
MSBuild 的所有版本