I had bird problems in my boat house. I am using strategically placed rubber snakes from Walmart as a deterrent. It has been working pretty well the last couple of years, no swallows, no pigeons.
What kind of barn ? If it is light truss construction you could staple plastic netting over the 2 by's . If they have places they prefer there are "nail strips " that are used for that : Bird-X Bird Repellent Devices solve bird problems. Roost Inhibitors include Bird Spikes, Bird Netting, Bird Proof Bird Shield.
There is a sticky foot glue that can be put down , a mirror sometimes spooks them, fake owl in the rafters, stick a cat up there ! Close the doors and screen any entry points. Pictures are always good to give us an idea of what you are up against. Good luck!