Should Businesses Create Their Own Custom Software?

When it comes to acquiring software, do you buy an "out of the box" software solution, or do you try to build a custom solution from scratch?