Hi,
I am using the final version of Framework 2.0. I have created a custom task called SimpleTask (modelled after the Hands-On-Lab document). When I try to use it in a project file, I get the following error message:
C:\tmp\I2DL\i2dl.proj(11,5): error MSB4062: The "SimpleTask" task could not be l
oaded from the assembly c:\tmp\vs6build\vs6build\bin\Debug\v6build.dll. Could no
t load file or assembly 'file:///c:\tmp\vs6build\vs6build\bin\Debug\v6build.dll'
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 d
ependencies are available.
0 Warning(s)
1 Error(s)
This is my project file:
<Project DefaultTargets="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask
TaskName="SimpleTask"
AssemblyFile="c:\tmp\vs6build\vs6build\bin\Debug\v6build.dll"
/>
<ItemGroup>
<vsprojects Include="i2dl.dsw"/>
</ItemGroup>
<Target Name="Buildv6">
<SimpleTask Executable="C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\msdev.exe" />
<SimpleTask Buildargs="\/nologo \/f i2dl.dsw \/make" />
<SimpleTask Basedirectory="c:\tmp\i2dl" />
</Target>
<Target Name="build" DependsOnTargets="Buildv6">
</Target>
</Project>
The assembly is located as it says in the project file. Is this a problem of the references Microsoft.Build.Framework.dll and Microsoft.Build.Utilities.dll
I am trying to make a custom task for building Visual C++ 6 projects - using the exec task will not include error logging as I have understood it.
/Chris

Custom task: assembly could not be found
M_Luka
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\MSBuild\SafeImports
I saw this problem just the other day and this fixed it. A better way to do this is to put your <UsingTask ...> in some <pick_a_name>.targets file and drop this targets file into a location that you can <Import ...> into your project file. Then put the full path to the targets file into the SafeImports section of the registry. This way, you only have to add the targets file once. The other way you would have to add each project file you use it in to SafeImports, well at least the ones you load into VS 2005.
Kapadia Shalin
Microsoft.Build.VisualJSharp, Version=2.0.0.0, Culture=neutral, PublicKeyToken
=b03f5f7f11d50a3a, processorArchitecture=x86
Microsoft.Build.Engine, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5
f7f11d50a3a, processorArchitecture=MSIL
Microsoft.Build.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b0
3f5f7f11d50a3a, processorArchitecture=MSIL
Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f
7f11d50a3a, processorArchitecture=MSIL
Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b0
3f5f7f11d50a3a, processorArchitecture=MSIL
Microsoft.CompactFramework.Build.Tasks, Version=8.0.0.0, Culture=neutral, Publ
icKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
Microsoft.VisualStudio.OfficeTools.Build.Tasks, Version=8.0.0.0, Culture=neutr
al, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
PresentationBuildTasks, Version=6.0.4030.0, Culture=neutral, PublicKeyToken=31
bf3856ad364e35, processorArchitecture=MSIL
So the dll's are in the GAC.
/Chris
pure
Not really sure if this is your problem but if the v6build.dll file is where it is supposed to be then also check to make sure that all of its dependencies are also in a location that MSBuild will look. In your case I think the solution is to place the other needed assemblies in the same folder as the v6build.dll. Let me know if this works.
Sayed Ibrahim Hashimi
dougseven
/Chris
anelson45
Thanks for answering me.
The only dependencies are Microsoft.Build.Framework.dll and Microsoft.Build.Utilities.dll which are found in the Framework path. This path is included in the PATH environment variable.
Here are my using statements:
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
/Chris
hfleong
JeffGoneMad
Dj Jamminx
Is your proejct under source control, and does your team sync to that source control depot If so your best bet is to check your tasks directly into your source control system. That way when developers enlist and bring down the tree they get all your custom assemblies and whatnot. This is what we do for our internal build system.
When you've done that you can then make the AssemblyFile path relative, or based on an environment variable. For example you could make it be something like <UsingTask AssemblyFile="$(MSBuildToolRoot)\EnterpriseBuildTasks.dll">, and then set MSBuildToolRoot in your command-line window to point to whatever the path to the enlisted directory with tools is.
Does that make sense It's a little late, I might be babbling stuff that sounds like crazy talk :)
Neil
Glaciered Pyro
<UsingTask AssemblyFile="C:\Windows\Microsoft.NET\Framework\v2.0.50727\EnterpriseBuildTasks.dll" TaskName="Publish"/>
I'm using the final release, but the examples I've followed don't seem to work properly. Is this a bug Can you explain what the SafeImports registry entry is suppose to do One of the reasons I've been looking as MSBuild over NAnt is so I can have my team not have to install special software and do special stuff to actually get the build working. Having to mess with the registry seems like a kludge workaround.
Derek Greer
Ruske
Having the path point to the Framework directory is not sufficient. Microsoft.Build.Framework.dll and Microsoft.Build.Utilities.dll need to either be in the GAC for Fusion to find them, or they need to be in the same directory as your task assembly. Try copying them over to the location of your task assembly.
(Also run gacutil -l to check if the MSBuild assemblies are installed.)
moronikos
QUEST 2005
Not sure if you've tried this - but you can also use the Fusion Log Viewer to get more details on failed assembly binds. Run fuslogvw from a Visual Studio Command prompt, and enable logging for failed binds, run your project and examine the log.
Faisal
RosarioDsilva
/Chris
Mustang33
I have tried with beta 2.0 framework and final version (recompiled the task) but both failed.
/Chris