How can a task find out the current project filename and path?
A task has no way of knowing what the current project filename and path is, unless it is explicitly passed in from the project. For example,
<Target Name="Build">
[<MyTask] Inputs="@(Foo)" Project="$(MSBuildProjectFile)" />
</Target>