Поделиться через


код диагностики MSB4062

В этой статье описывается код ошибки 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.

Описание

Эта ошибка возникает, когда 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