MOSFET burning out when attached to a solenoid
Making a few assumptions from what you wrote and the partial circuit diagram, the un-clamped inductive kickback from the solenoid the instant the transistor is switched off, is likely exceeding the max Vds rating of your transistor and destroying it.  

But like the folks above mention, in electronics, the details are important and you have provided very little information regarding the actual values of the components involved.  

I hope that helps a little.