共用方式為


MSB4062:無法從組件載入工作

執行工作之前無法載入工作組件時,就會發出此錯誤。

當工作在非針對該工作所準備的環境中執行時 (例如當工作組件以 32 位元 x86 為目標,但在 64 位元 MSBuild 環境中執行時),可能會造成錯誤 MSB4018。

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 元素中表示對所需執行階段環境的相依性。