Well, lack of appetite
is the main reason for not gaining weight. But if you want to put on weight, you have no choice but to eat. Ice cream and all other items that you love eating, you should eat.
All those appetite increasing drugs are not really effective. What is required is a strong will to gain weight and eat normal food as medicine, even if you don't feel like eating.