The government has pledged to invest £44bn in a housebuilding programme that will provide 300,000 new homes a year.