As a common practice in many industries, outsourcing has two main structures, namely turnkey (contract manufacturers (CMs) purchase components from suppliers directly) and buy-sell (original equipment manufacturers (OEMs) purchase components from suppliers and resell them to CMs). However, outsourcing may result in product quality problems. How to choose an appropriate outsourcing structure considering quality management is an important problem faced by OEMs. In this paper we consider a system comprising one OEM and one CM, and study their equilibrium policies under the turnkey and buy-sell. Then we compare the OEM's profits under the two structures and identify conditions under which one structure outperforms the other one. For the case where the compensation is an exogenous parameter, we show that which structure is optimal depends on the compensation, the external failure cost, the cost differences between the two suppliers and the CM's crafts, and the non-defective rates of the low-type supplier and low-level process craft. When the compensation is higher than the external failure cost, the OEM should choose turnkey. Otherwise, which structure is better depends on the parameters. We then consider the case where the compensation is a decision variable and find that the OEM should choose turnkey. Finally, considering the case where the players have different market powers, we find that turnkey is optimal when the CM is more powerful. When the OEM is more powerful, turnkey is better when the external failure cost is low and the OEM's market power is not too high; otherwise, buy-sell is better.