A general formula for the anisotropic outer Minkowski content of a set