Improve MD location lookup in build tasks