1

Closed

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

description

Overview

Basically, when we try to run MSBuild build "compile;package" we receive the following 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.

Steps to Reproduce

  1. Do a fresh source code drop from https://hg01.codeplex.com/orchard and switch to the 1x branch.
  2. Then try to build "compile;package" before even opening the src in Visual Studio.
  3. At the time we did this, we were on ##55a99efaa85309d810a0fcfadcc791cef03e6dc0 of the 1x branch.

More Details

Please see discussion https://orchard.codeplex.com/discussions/444942 for more details.
Closed May 31, 2013 at 8:51 PM by BertrandLeRoy

comments

ShaunLuttin wrote May 28, 2013 at 6:33 PM

I just replicated this with 1x ##44b058750e2f04139f4546122027ff12687d5909.

ShaunLuttin wrote May 28, 2013 at 7:15 PM

Fix / Work Around

Absolute Path Does Work

  <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" />

Existing Relative Path Does NOT Work

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

nightwolf226 wrote May 28, 2013 at 9:24 PM

It's a duplicate of issue #19688. See my comments at the end, you don't have to use an absolute path, but one without $(ProjectDir), although I have no idea why it breaks.

ShaunLuttin wrote May 28, 2013 at 10:36 PM

Thank you nightwolf226 for the feedback.

sebastienros wrote May 29, 2013 at 7:40 PM

It works for me, isn't it because you have a strange char in your path, one which actually could be interpreted by the msbuild task ? -> "@"

nightwolf226 wrote May 29, 2013 at 8:15 PM

That's not the case for me. :(
But it only occurs with TeamCity using MSBuild on our deployment server.

ShaunLuttin wrote May 30, 2013 at 3:26 AM

I do not see the strange char here:
<UsingTask AssemblyFile="$(ProjectDir)..\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.XmlDelete" />

sebastienros wrote May 30, 2013 at 5:48 PM

@ShaunLuttin: I mean that the $(ProjectDir) value actually contains a '@'. Could you try to run the command with the source code inside a folder which doesn't have a '@' in it ?

The value I see from your stack trace is C:\Users\Shaun\Documents\@GitHub\CertifiedOverheadCrane\orchard1x

ShaunLuttin wrote May 31, 2013 at 8:35 PM

@sebastienros Gotcha. I took out the @ symbol and kaboom, it worked. Thank you.
Image