The host galaxies of long-duration gamma-ray bursts in a cosmological hierarchical scenario