Cross-dressing (from compulsion) is DEFINATELY a sin. I should know. I have been plagued by this vice for all my adult life. I am sick of it. It is demonic. There is a clear erotic element to this sin, and therefore it is mortally sinful.
St Thomas Aquinas addressed this… he said [paraphrasing] that wearing the attire of the opposite sex arouses sexual feelings in some people and therefore it is sinful to do so.
The devil will use ANYTHING he can to make you turn from God. Some men can dress up for a pantomime and feel stupid. The case can be made that such people are not sinning against purity, as it is never an occasion of sin for them.
However, the person who has a compulsion to cross-dress, does so for some sort of thinly disguised sexual release. In such cases, cross-dressing is a type of pornography. It is an occasion of mortal sin, and therefore must be avoided like any other occasion.
It is not a harmless vice. It falls basically under the category of “masturbation”.
One solution is to find good hobbies that one can do to enjoy recreation time; to avoid wireless internet, laptops etc.; to reduce time-alone; to say the daily Rosary and frequent confession persistently.