Protein. I mean, meat, milk, egg, cheese, beans etc. Make sure you eat at least one of them everyday, and also have 3 full rations everyday... If you can't gain weight despite these, you probably have a metabolic problem so it's best to consult a doctor or dietician..
Being underweight is as much as a kick to self esteem as being overweight, except us skinny people can't do anything about it! It's taken me years to accept my build will never be anything other than 'slim', so the only advice would be learn to accept and love your own body, whatever shape or size you are.
squats, squats, and squats!!!