  We study the luminosity function (LF), the comoving rate and the detection
rate of Long Gamma-Ray Burst (LGRBs) to high redshift, using galaxy catalogues
constructed by combining high-resolution N-body simulations with semi-analytic
models of galaxy formation. We assume the collapsar model and different
metallicity thresholds, and conclude that LGRBs are not good tracers of the
star formation history in the universe. Then using the log N-log P diagram for
BATSE bursts, we determine the LF (with and without evolution with redshift)
and the formation rate of LGRBs, obtaining constraints on the slope of the
power-law. We check the resulting redshift distribution with SWIFT data updated
to 2009 August, finding that models where LGRBs have as progenitors stars with
Z<0.3Z_sun and without evolution of the LF are in agreement with the data. We
also predict that there are about ~1% of GRBs at redshift z>6.
