We develop a new Yang-Mills theory for connections D in a vector bundle E with bundle metric h, over a Riemannian manifold by dropping the customary assumption Dh = 0. We apply this theory to Einstein-Weyl geometry (cf. M.F. Atiyah, et al., Self-duality in four-dimensional Riemannian geometry, Proc. Roy. Soc. London 362 (1978) 425-461, and H. Pedersen, et al., Einstein-Weyl deformations and submanifolds, Internat. J. Math. 7 (1996) 705-719) and to affine differential geometry (cf. F. Dillen, et al., Conjugate connections and Radon's theorem in affine differential geometry, Monatshefts fur Mathematik 109 (1990) 221-235). We show that a Weyl structure (D, g) on a 4-dimensional manifold is a minimizer of the functional (D, g) proves > 2 integral(M) parallel toR(D)parallel to(2)upsilon(g) if and only if R-*(D) = +/-R-D*, where D-* is conjugate to D. Moreover, we show that the induced connection on an affine hypersphere M is a Yang-Mills connection if and only if M is a quadratic affine hypersurface. (C) 2002 Elsevier Science B.V. All rights reserved.