Nov 17, 2012

Empty Reference file generation error

Yesterday, I came across this issue where the App.config for a Class Library was not getting modified on addition of a Service Reference. Ideally, the App.config should get the endpoint, bindings, behaviours and other details from the service reference url.

So, I went about looking into the issue.
After investigation I found that since the Reference file getting generated was empty, it was not updating the App.config. This was happening because of conflict of types in the referenced assemblies. When I was trying to add the service reference, the Client which was consuming this service also referenced the same type as contained in the DataContract of the service.

To resolve this error, I did the following:-
1) Right-click the Service Reference which is added to the Client.
2) Click "Configure Service Reference".
3) Uncheck "Reuse types in referenced assemblies" and click Ok.

This ensured that the types are not reused in the Referenced assemblies.
Now, the Reference file was generated and the App.config was also updated.

Hope it helps.