This is a great question and one that gets to heart of the counsel of Machiavelli. Machiavelli states that virtue is central in the life of the prince, at least in his public persona. He defines virtue as the quality that is universally praised by people. He lists qualities such as generosity and piety. Since people resonate with these virtues, it is important that a prince appears virtuous.
Perception is enough though. A good price will have to be cruel and not virtuous at times to get the job done. Hence, there is no understanding of virtue for virtue's sake. Virtue and for that matter vice is all a means to an end. However, if a prince has to be not virtuous, he should get someone else to do if for him, so that he could keep up appearances of piety.
In a word, virtue, like everything else, is means to rule.