"David Cameron has said if he is Prime Minister, there will be an In-Out referendum in the next Parliament and that in this Parliament, we will look at all options to underline the fact that our commitment to the referendum is absolute," said William Hague, U.K. foreign secretary in a press release after the bill's publication.

"So today the Conservative Party is publishing a draft bill to legislate for an in-out referendum before the end of 2017. We will examine all opportunities to bring this bill before Parliament, including as a private members' bill."

European finance ministers speak to CNBC about whether there's a credible threat of Britain leaving the European Union.

Earlier on Tuesday, EU finance ministers attending the monthly meeting of finance ministers (ECOFIN) in Brussels said the U.K. should be careful what it wished for, and should recognize the benefits as part of the group of 27 countries.

"Each country had the right to decide whether to participate in the EU," Luxembourg's Finance Minister Luc Frieden told CNBC. "I only hope the citizens of the U.K. see that participating in the single market and a peace project such as the EU gives a lot of benefits to the U.K."

The finance minister of Lithuania, Rimantas Sadzius, went further, saying a U.K. exit would damage the entire bloc.

"It would be harmful for the EU if any country, small or large, leaves the EU. The single market is our achievement in Europe, in the post-world war two years, and we must preserve these values," said Sadzius.

However, Danish Finance Minister Margrethe Vestager said she empathized with the U.K's concerns about Europe's legal framework.

"We have our own frustration, but what is needed is that the single market gets to function better, because we need Europe as a growth engine," she said.

Pierre Moscovici, France's finance minister, said the U.K. could not pick and choose the details of its membership.

"I'm in favor of Britain in the EU. We've got a common history and politics together, but of course the citizens will have to decide," said Moscovici.

"But one thing that must be clear is that we are not in favor of a Europe 'a la carte'. We must stick to what we have together, which is this EU, with a place for the U.K. But we must not adapt the European construction to some political debates inside a country."

Moscovici's comments followed from a war of words between France and the U.K. over trade relations in the EU. London Mayor Boris Johnson said he would "roll out the red carpet" for French businesses to move to London, only for France's Foreign Minister Laurent Fabius to retort that France would happily "roll out the red carpet" for Britain to leave the EU.

The remarks by Europe's financial leaders come after U.S. President Barack Obama said the U.K. should "fix" its relationship with the EU before "breaking it off."

Cameron's Promise

A rise in euroscepticism within the U.K. has put pressure on Cameron's Conservative Party to renegotiate the terms of Britain's membership of the EU. The draft bill follows Cameron's promise of a referendum on EU membership if his party wins another term in power at the 2015 elections.

The leader of the anti-EU "UK Independence Party" (UKIP), which made major gains in local elections at the start of May, told CNBC that Cameron was trying to appease disaffected voters who were switching to them.

"This is a desperate attempt to get people to trust Cameron on delivering on an EU referendum," Nigel Farage told CNBC on Tuesday.

"But why on earth do we have to wait another four and a half years to express an opinion in a democratic nation?" he said, adding that he wanted a referendum as soon as possible.

"This bill is not worth a row of beans because one parliament cannot bind another parliament to do anything. The bill will get airtime bill in parliament but getting it to pass would mean substantial number of Labour MPs (opposition politicians), so I doubt it will happen," he said.