次の方法で共有


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 のすべてのバージョン