Thermosolutal convection in a square cavity filled with Boussinesq fluid is numerically investigated. The cavity is heated along the active walls whereas the two other walls of the cavity are adiabatic and insulated. Entropy generation due to heat and mass transfer, fluid friction and magnetic effect has been determined in transient state for laminar flow by solving numerically the continuity, momentum energy and mass balance equations, using a Control Volume Finite-Element Method. The structure of the studied flows depends on six dimensionless parameters which are the Prandtl number, the thermal Grashof number, the buoyancy ratio, the Lewis number, the Hartman number and the inclination angle of the magnetic field. Results show that the magnetic field parameter has reducing the flow in the cavity and this lead to a decrease of entropy generation, Temperature decreases with increasing the value of the magnetic field parameter. The average Nusselt number increases with the Prandtl number and, in particular, its effect is more evident at high Hartmann numbers.