Error running project / target

Jan 7, 2010 at 9:28 PM

I'm just getting up to speed on MSBuild, and have discovered MSBEP and MSBuild Explorer.

I installed MSBEP in a non-standard location (so that it will end up in my project's source tree), and get the following error when I attempt to run any of the samples:

c:\path_elided\MSBuild.ExtensionPack\Samples>MsBuild Maths.proj
Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.4200]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 1/7/2010 1:16:13 PM.
Project "c:\path_elided\MSBuild.ExtensionPack\Samples\Maths.proj" on node 0 (default targets)
.
c:\path_elided\MSBuild.ExtensionPack\Samples\Maths.proj(9,9): error MSB4062: The "MSBuild.Ext
ensionPack.Science.Maths" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\ExtensionPack\MSBuild.Extensi
onPack.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\ExtensionPack\MSBuild.ExtensionPack.dll' or o
ne of its dependencies. The system cannot find the file specified. Confirm that the  declaration is correct, and that
the assembly and all its dependencies are available.
Done Building Project "c:\path_elided\MSBuild.ExtensionPack\Samples\Maths.proj" (default targ
ets) -- FAILED.


Build FAILED.

"c:\path_elided\MSBuild.ExtensionPack\Samples\Maths.proj" (default target) (1) ->
(Default target) ->
  c:\path_elided\MSBuild.ExtensionPack\Samples\Maths.proj(9,9): error MSB4062: The "MSBuild.E
xtensionPack.Science.Maths" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\ExtensionPack\MSBuild.Exten
sionPack.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\ExtensionPack\MSBuild.ExtensionPack.dll' or
 one of its dependencies. The system cannot find the file specified. Confirm that the  declaration is correct, and tha
t the assembly and all its dependencies are available.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.00

This error implies that MSBEP must be installed in the MSI default location. Is this correct? If not, how can I get past this error?

Thanks!

~stuart

 

Coordinator
Jan 11, 2010 at 8:52 AM

Hi Stuart

That's a bit odd. It should work fine. The samples use the following import

<PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>

So TPath should be resolved to $(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks for you. Can you run with /v:diag and let me knwo what the value of the TPath property is.

Which version are you using.

Mike

 

Jan 11, 2010 at 5:28 PM

Hi Mike,

I ended up re-installing in the default location. I'd still prefer to add MSBEP to our source tree, though - so if I end up doing that I'll try to circle back to this and send you the results of /v:diag if I still get the error.

This was with the release version, 3.5.4.0.

 

Oct 5, 2010 at 10:55 AM
Edited Oct 5, 2010 at 11:45 AM

Actually, you can but the ExtensionPack in your source tree. The way to do it is to add the ExtensionPack dll's in a "known" directory structure. The way I made it work was to put the dll's in "\Tools\MSBuild Extension Pack\ExtensionPack\4.0". Then I referred to the extensions path property to the tools directory, like this;

<MSBuildExtensionsPath>$(ToolsDir)\MSBuild Extension Pack</MSBuildExtensionsPath>

Where 'ToolsDir' is the path to the tools directory in our source tree. And i put the .tasks-file there as well;

<MSBuildExtensionPackTasksPath>$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</MSBuildExtensionPackTasksPath>

Importing the extension pack;

<Import Project="$(MSBuildExtensionPackTasksPath)"/>

 Seems like there's a presumption somewhere that the ExtensionPack dll's need to be under the specific directory structure '\ExtensionPack\4.0'.

 

-kjetil