Electrochemical deposition technique for room-temperature fabrication of functionalized metal–organic frameworks (MOFs) have attracted increasing attention in many important applications. Herein, a sensitive electrochemiluminescent (ECL) immunosensor was fabricated for the determination of classical swine fever virus (CSFV) based on electrochemical synthesis and deposition of pyrazine-templated ruthenium (II)-MOFs (Pyz-Ru@MOFs) thin films on the electrode surface. In this protocol, the 2D Pyz-Ru@MOFs nanosheets were synthesized under green water phase condition from the carboxyl-rich tris(4,4′-dicarboxylic acid-2,2′-bipyridyl) ruthenium(II) (Ru(dcbpy)32+) as ECL luminophore and organic ligand to coordinate with zinc ions, and pyrazine as a structure-directing agent to control the formation of sheetlike structure. Due to packaging plenty of Ru(dcbpy)32+ molecules in the frameworks, the mesoporous thin films of Pyz-Ru@MOFs exhibited excellent ECL performance. Using this 2D Pyz-Ru@MOFs as a sensing platform, a “signal-off” ECL immunosensor was constructed for CSFV analysis, which displayed high sensitivity and good selectivity for CSFV detection in the range of 10 fg mL−1 –10 ng mL−1 with a detection limit of 5.4 fg mL−1. In addition, the prepared immunosensor was successfully utilized for the satisfactory detection of CSFV in serum samples, which has potential application in biological analysis and clinical diagnosis. This proposed woke also provided a simple and feasible electrochemical synthesis strategy to construct 2D luminescent MOFs immobilized ECL luminophores, offering significant inspiration to develop highly efficient ECL materials at room temperature with ECL sensing applications.