In this work, we describe the homo- and hetero-epitaxial growth of hexagonal and cubic MgxZn1-xO thin films on lattice matched substrates of c-Al2O3, ZnO, MgO and SrTiO 3. The crystalline quality, composition and epitaxial nature of the alloy films are obtained by x-ray diffraction and Rutherford backscattering spectroscopy (RBS) techniques. The RBS channeling yields are in the range 3-8% for homoepitaxial and hetero-epitaxial thin films. The metal-semiconductor-metal and ultraviolet detectors were fabricated on hexagonal and cubic Mg xZn1-xO thin films and the leakage current and UV-visible rejection ratio are correlated with the epitaxial relationship between the film and substrates. © 2007 IOP Publishing Ltd.