build "compile;package" error MSB4062 related to MSBuild.Orchard.Tasks.ValidateExtensionProjectFiles

Topics: General
May 24, 2013 at 10:56 PM
Edited May 24, 2013 at 11:36 PM
Hi there,

How do we troubleshoot or resolve the following MS Build Error?
C:\Users\Shaun\Documents\@GitHub\CertifiedOverheadCrane\orchard\Orchard.proj(443,5): error MSB4062: The "MSBuild.Orchard.Tasks.ValidateExtensionProjectFiles" task could
not be loaded from the assembly C:\Users\Shaun\Documents\%40GitHub\CertifiedOverheadCrane\orchard\buildtasks\MSBuild.Orchard.Tasks.dll. Could not load file or assembly '
file:///C:\Users\Shaun\Documents\%40GitHub\CertifiedOverheadCrane\orchard\buildtasks\MSBuild.Orchard.Tasks.dll' or one of its dependencies. The system cannot find the file specified. 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.
Troubleshooting Attempts:
  • Build and to rebuild the solution in Visual Studio. Done. It works.
  • In the Orchard.proj file we comment out the following line:
<UsingTask AssemblyFile="$(MsBuildTasksFolder)\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.ValidateExtensionProjectFiles" />
  • at which point we get this error:
C:\Users\Shaun\Documents\@GitHub\CertifiedOverheadCrane\orchard\Orchard.proj(443,5): error MSB4036: The "ValidateExtensionProjectFiles" task was not found. Check the fol
lowing: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framewo
rk.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v
4.0.30319" directory.
  • So, comment out the following line instead.
<ValidateExtensionProjectFiles Files="@(Validate-ProjectFiles)"/>
  • at which point we get this error:
C:\Users\Shaun\Documents\@GitHub\CertifiedOverheadCrane\orchard\Orchard.proj(197,5): error MSB4062: The "MSBuild.Orchard.Tasks.FilterModuleBinaries" task could not be lo
aded from the assembly C:\Users\Shaun\Documents\%40GitHub\CertifiedOverheadCrane\orchard\buildtasks\MSBuild.Orchard.Tasks.dll. Could not load file or assembly 'file:///C
:\Users\Shaun\Documents\%40GitHub\CertifiedOverheadCrane\orchard\buildtasks\MSBuild.Orchard.Tasks.dll' or one of its dependencies. The system cannot find the file specif
ied. 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.
  • Update our site to a a fresh version of Orchard 1.x from the repository. Same error.
C:\Users\Shaun\Documents\@GitHub\CertifiedOverheadCrane\orchard\Orchard.proj(444,5): error MSB4062: The "MSBuild.Orchard.Tasks.ValidateExtensionProjectFiles" task could
not be loaded from the assembly C:\Users\Shaun\Documents\%40GitHub\CertifiedOverheadCrane\orchard\buildtasks\MSBuild.Orchard.Tasks.dll. Could not load file or assembly '
file:///C:\Users\Shaun\Documents\%40GitHub\CertifiedOverheadCrane\orchard\buildtasks\MSBuild.Orchard.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class th at implements Microsoft.Build.Framework.ITask.
  • Do a fresh source code drop from https://hg01.codeplex.com/orchard and switch to the 1x branch.
  • Then try to build "compile;package" before even opening the src in Visual Studio.
  • Same error. That means that ##55a99efaa85309d810a0fcfadcc791cef03e6dc0 of the 1x branch does not work.
C:\Users\Shaun\Documents\@GitHub\CertifiedOverheadCrane2\Orchard.proj(444,5): error MSB4062: The "MSBuild.Orchard.Tasks.ValidateExtensionProjectFiles" task could not be
loaded from the assembly C:\Users\Shaun\Documents\%40GitHub\CertifiedOverheadCrane2\buildtasks\MSBuild.Orchard.Tasks.dll. Could not load file or assembly 'file:///C:\Use
rs\Shaun\Documents\%40GitHub\CertifiedOverheadCrane2\buildtasks\MSBuild.Orchard.Tasks.dll' or one of its dependencies. The system cannot find the file specified. 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 Microso
ft.Build.Framework.ITask.
Coordinator
May 26, 2013 at 6:32 AM
Please file a bug.
May 28, 2013 at 3:10 AM
May 28, 2013 at 7:24 PM
The problem is that the <UsingTask> declaration is incorrect.

Workaround

Relative Path (Incorrect)

<UsingTask 
     AssemblyFile="$(ProjectDir)\..\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll" 
     TaskName="MSBuild.Orchard.Tasks.XmlDelete" />

Absolute Path (Correct)

<UsingTask 
     AssemblyFile="C:\Users\Shaun\Documents\@GitHub\CertifiedOverheadCrane\orchard1x\src\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll"
     TaskName="MSBuild.Orchard.Tasks.XmlDelete" />
Cheers,
Shaun