Historical context: Judah's rebellion against the Babylonian empire resulted in an overwhelming defeat. The center of government, Jerusalem, fell, many people were taken into exile, and the Temple, the center of worship, was destroyed. Almost 50 years later, Persia defeated Babylon, and allowed the people to go back to Jerusalem to rebuild the temple (from commentary in The Jewish Study Bible.)
The word of the Lord came to the prophet Haggai, "Tell the governor and the high priest and the remnant of the people that are left to remember the greatness of the Temple and to look at the rubble it was turned into."
Being faithful does not mean ignoring pain or defeat.
But, in their case, just looking and grieving was not all that the Lord had in mind for them. "Tell them: take courage, I am with you. I was with you when you came out of Egypt. I am with you now. Things are going to get better for you. Rebuild the temple."
No, the church is not a building, but gathering to worship is essential for the church. So, the building that houses that place is important. Many of the prophets had scorn for the temple and what went on there, but none of the prophets can be interpreted to mean that right worship is anything but right--and since the building is the place, then we who gather there should in all ways think and act as God's people.
Interesting sideline (also from JSB): The Lord promises that gold and silver from all over is going to come to Jerusalem. But, note that this treasure is not intended to enrich individuals; rather, it is the Lord's.
A portion of this passage is quoted in Handel's Messiah: Thus Sayeth the Lord