“Do not let this thing be evil in your eyes.” David’s words are ironic. What David and Joab did was evil. To an outsider who did not know the situation, the “evil” was the death of a good man in a battle with the enemy. But the real “evil” was the plot that David hatched and Joab carried out to kill Uriah. What David did was clearly evil in the eyes of God (2 Sam. 11:27).
“So you are to encourage him.” David tells the messenger to encourage Joab.