Tensile dislocations are often employed to model magma intrusion within volcanic edifices through lateral or feeding dykes. In spite of the large heterogeneity inferred (e.g. from seismic tomography studies) in volcanic areas, most crack models of dykes so far have been developed in homogeneous media. In this paper the simplest elastic medium is considered, consisting of two welded half-spaces, characterized by different elastic parameters. A plane-strain configuration is assumed. The elementary dislocation problem is solved in which a constant Burgers Vector is assigned along a rectilinear dislocation line parallel to the plane separating the two half-spaces; the dislocation surface is a half-plane orthogonal to the interface and bounded by the dislocation line. Case I is considered first, in which the dislocation surface is entirely contained in one half-space (half-space 1). Explicit analytic solutions are provided for all components of the displacement and stress fields all over the medium; these are found to reproduce previously published results, which were, however, limited to the dislocation plane and to one component of stress. If the rigidity of the half-space 2 vanishes, the present results reproduce the solutions for the tensile dislocation problem in a half-space with a free surface. Explicit solutions are furthermore given for case II, in which the dislocation line is in the half-space 2 and the dislocation surface cuts the interface between the two media and all of the half-space 1. Finally, closed dislocation surfaces, bounded in the dip direction, are obtained by the superposition of solutions pertinent to two different dislocation lines, and stress fields are compared with solutions in a homogeneous unbounded medium endowed with the same elastic parameters assumed for the harder half-space 1. Results for all non-vanishing stress components are shown graphically in two models: in model A both dislocation lines are embedded in half-space 1; in model B, one dislocation line is embedded in half-space 1 and the other in half-space 2. Stress components, which must be continuous across the interface between the hard and soft half-spaces, are found to be significantly lower in the harder half-space than in the homogeneous model. On the other hand, the stress component normal to the dislocation surface, which is not involved in the welded boundary condition, is significantly higher along the hard side of the interface in model A, while in model B it is significantly lower near the dislocation-interface crossing. The importance of analytical solutions for the elementary dislocation problem in a layered medium is strengthened by their role as integral kernels to be employed in crack models of pressurized dykes.