We construct all self-adjoint Schrödinger and Dirac operators (Hamiltonians) with both the pure Aharonov-Bohm (AB) field and the so-called magnetic-solenoid field (a collinear superposition of the AB field and a constant magnetic field). We perform a spectral analysis for these operators, which includes finding spectra and spectral decompositions, or inversion formulae. In constructing the Hamiltonians and performing their spectral analysis, we follow, respectively, the von Neumann theory of self-adjoint extensions of symmetric operators and the Krein method of guiding functionals.