Condensation of malononitrile (I) with triethyl orthoacetate (II) in pyridine produced the intermediate (III), which was cyclized to pyridine (IV) by acidic treatment. Reductive dechlorination of (IV) by hydrogenation over Pd/BaCO3 afforded 2-aminopyridine-3,5-dicarbonitrile (V). Subsequent condensation of (V) with guanidine (VI) gave rise to the pyridopyrimidine system (VII). Finally, reductive amination of (VII) with 2-chloroaniline (VIII) by means of H2 and Raney-Ni afforded the title compound.