This paper studies optimal licensing contracts in the presence of moral hazard associated with costly provision of know-how by the licensor. In our setting, the target market is defined as the fraction of consumers that have a positive valuation for the product that is licensed. It is shown that, no matter how thin the target market is, know-how transfer always takes place. Consistent with actual practice, the optimal licensing contract includes a royalty on sales to attenuate the moral hazard problem. However, full know-how transfer will not occur for low enough maximum willingness to pay and high enough convexity of know-how cost. Finally, it is also shown that the effective (inclusive of the royalty) marginal cost exceeds the one when know-how transfer does not occur thus showing a potential malfunction of know-how transfer specially if the recipient is a developing country.