Since there's no other answer, here's a complete sample of building a dll from any number of source files on the go like talked about in the comments. Two sourcefiles:
sometask.cs:
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Bar;
namespace Foo
{
public class CustomTask : Task
{
public override bool Execute()
{
Log.LogWarning( LogString.Get() );
return true;
}
}
}
sometask_impl.cs:
namespace Bar
{
public static class LogString
{
public static string Get()
{
return "task impl";
}
}
}
And the msbuild file with a target which uses Foo.CustomTask, but builds it first:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="MyBuild">
<PropertyGroup>
<SomeTaskDll>SomeTask.dll</SomeTaskDll>
</PropertyGroup>
<Target Name="BuildSomeTaskDll">
<Csc Sources="$(MSBuildThisFileDirectory)sometask*.cs"
References="System.dll;mscorlib.dll;Microsoft.Build.Framework.dll;Microsoft.Build.Utilities.v4.0.dll"
TargetType="Library" OutputAssembly="$(MSBuildThisFileDirectory)$(SomeTaskDll)"/>
</Target>
<UsingTask TaskName="Foo.CustomTask" AssemblyFile="$(SomeTaskDll)"/>
<Target Name="MyBuild" DependsOnTargets="BuildSomeTaskDll">
<Foo.CustomTask />
</Target>
</Project>
Relevant output:
> msbuild sometask.targets
Project sometask.targets on node 1 (default targets).
BuildSomeTaskDll:
<here it's building SomeTask.dll>
sometask.targets(17,5): warning : task impl