1) Plenty of people here are unconvinced about the efficacy of ultrasound at stopping a dog barking. The idea appears to be a crazy one to many,
2) It's possible to build one but why? It's cheaper to buy one and if it doesn't work, it's likely you'll be able to return it, for no more than the price of postage. This is more of a professional engineering forum, than a hobbyist one. If the best solution is to buy off the shelf, then that's the advice you'll get.
If you must go DIY, go for a tweeter, audio amplifier, a digital signal synthesis IC and microcontroller.