Nitrile-containing azoloazines with a bridged nitrogen atom are of interest as molecules with potential antiviral and antidiabetic effects. A few examples of the corresponding 7-aminoazolo[1,5-a]pyrimidine-6-carbonitriles have been described in the publications, but there is no versatile method for their synthesis to date, which limits the scope of structure optimization to obtain compounds with desired biological properties. In this work, different conditions of cyclocondensation of aminoazoles and ethoxymethylene malononitrile were investigated and it has been shown that the optimal method for the synthesis of 7-aminoazolo[1,5-a]pyrimidine-6-carbonitriles is heating the starting reactants in pyridine. A library of different azolopyrimidines containing both electron donating and electron withdrawingsubstituents in the azole fragment was obtained by this method.