I had carpenter bees making holes in my porch rafters until I put up a fake hornet's nest. I bought a few of these, and they effectively prevent both hornets and carpenter bees from making a home within view of the fake nest.
I discovered this method after spraying a real hornet's nest and leaving it in place for a couple of years. During that time, no other nests were built within sight of it. The fake nests I use resemble paper lanterns and cost about $2-$3 each online. However, you can also make your own.
I've been using these fake hornet's nests for several years now and have never had an issue with new hornet nests being built within view of them. The carpenter bees have also vacated the area.