Kant had written about morality in several of his earlier works, but The Groundwork (or Foundations) of the Metaphysics of Morals, published in 1785, was his first book devoted exclusively to ethical theory. As its title indicates and as Kant also stated in its preface, this book was intended to provide the foundations or groundwork for a future work entitled The Metaphysics of Morals. He had claimed to be writing a book on that topic as early as 1768, but he did not actually publish this volume until 1797. (The Critique of Practical Reason was published in 1788 and the Critique of Judgment in 1790.) Given the time he had to think about its contents and the fact that he waited until near the end of his professional life to issue it, presumably The Metaphysics of Morals reflects his most mature views on the topics discussed in it. Strangely enough, however, most people interested in Kant's moral theory have tended to neglect The Metaphysics of Morals and have devoted themselves instead to analyzing the volume meant only to be its introduction. They have thought that the first half of the later volume, the "Doctrine of Right," does not fit in at all with his moral theory, and they also have rejected everything in the second half, the "Doctrine of Virtue," that does not agree with the ways in which they had already interpreted the Groundwork.
(Roger J. Sullivan, "Introduction," in The Metaphysics of Morals, by Immanuel Kant, trans. and ed. Mary Gregor, Cambridge Texts in the History of Philosophy, ed. Karl Ameriks and Desmond M. Clarke [Cambridge: Cambridge University Press, 1996], vii-xxvi, at vii)