This project is read-only.

Newbie Q: Could not load file or assembly MSBuild.ExtensionPack

Feb 19, 2009 at 9:27 PM
I have just started using the MSBuild extension pack.  I had been writing custom tasks previously, and seemed to work okay.

I began simply by just trying to extend the BaseTask.

public class InstallShieldTask : BaseTask { .... }

error MSB4062: The "MessageOne.MSBuildTasks.InstallShieldTask" task could not be loaded from the assembly C:\Documents and Settings\mscott\My Documents\Visual Studio 2008\Projects\InstallShieldTask\InstallShieldTask\bin\Debug\InstallShieldTask.dll. Could not load file or assembly 'MSBuild.ExtensionPack, Version=, Culture=en-GB, Public KeyToken=10d297e8e737fe34' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.

I am just calling the simple task from a very small msbuild project file.  It doesn't fail by my having the UsingTask directive, loading my assembly, but only if i actually use my code.

I have the extension pack installed to it's default directory, and Visual Studio seems to have no problems with it when creating a reference.

Does anything jump out what could be the problem?


Feb 19, 2009 at 10:27 PM

Do you have copy local set to true for that reference? The MSBEP assemblies are not GAC'ed.

Feb 19, 2009 at 10:35 PM
Yes, and I verified that that MSBuild.ExtensionPack.dll and it's PDB file get copied to the output directory of my custom task.

Feb 19, 2009 at 11:14 PM
I ran fusion log viewer and it looks like its resolving to the Culture, so if you create a folder called 'en-GB' in the debug folder, then copy the MSBEP dll into it, you code will work.

I'm not sure what benefit this approach is going to give you though. You may be better off getting the code for the basetask and simply using it in your project. That way you wont get the weight of the MSBEP reference added in.

Feb 27, 2009 at 9:25 PM
Thanks, this helped me resolve the issue for the moment.

I anticipate using more than just the BaseTask from MSBEP, but it was a nice starting point for a few tasks I am writing at the moment.

It seems that the assemblies for MSBEP should be culture neutra ("")l, because at the moment with the [assembly:AssemblyCulture("en-GB")] attribute, it causes it to be a localized satellite assembly, which you should not reference directly.