Add service reference adding empty reference.cs in MVC 4 projects of VS 2012

In VS 2012 MVC 4 projects, do you find an empty reference.cs file while adding a service reference to a WCF service using 'Add service reference' dialog?

Here is what you can do about it:

Check if your error tab shows some error like...

Warning 1 Custom tool warning: Cannot import wsdl:portType

Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter

Error: Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself.

XPath to Error Source: //wsdl:definitions[@targetNamespace='https://tempuri.org/']/wsdl:portType[@name='IService1']

If so, you can use the following work around(s):

1. In add service reference dialog -> [Advanced ... ] -> Reuse types in referenced assemblies (Checked by default) -> Choose the non default 'Reuse types in specified referenced assemblies' radio -> Make sure you exclude Newtonsoft.Json.dll from the list. Try adding service reference now and see it succeeds.

2. Alternatively you can remove reference of this Newtonsoft.Json.dll while generating proxy and add that back after proxy generation is complete.