Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty reference.cs file adding service reference with reuse types option checked

Scenario

  • Visual Studio 2010
  • Silverlight 4
  • Entity Framework
  • Self-tracking entities

Problem

On the server side, we have generated entity objects using Entity Framework model. We have used self tracking T4 templates to generate the entities. These entities are shared and can be used from the client side (Silverlight 4 project).

But when we try to add a new Web Service reference, the proxy generator don't work. The reference.cs file is empty. We have checked the option 'Reuse Types' in the configuration of the Web Reference. We have checked the assemblies that will be shared (entity assemblies only).

We have tried to remove every (IsReference=true) from DataContract attributes of the entities but it did not work.

Any idea or workaround?

like image 839
Nadya Avatar asked Jun 14 '11 10:06

Nadya


2 Answers

Unchecking the "Reuse Types" worked for me. The code generator walks the object graph of dependencies and if it encounters any problem, like a reference not found, then it blows up and doesn't produce any code in the reference.cs.

like image 152
Robert Corvus Avatar answered Sep 28 '22 17:09

Robert Corvus


This can occur when the assembly your are trying to share is compiled against a higher .NET platform.

For example if your project is targeting .NET 3.5 and the assembly is compiled against 4.0 this will happen.

like image 21
Chris Hawkins Avatar answered Sep 28 '22 17:09

Chris Hawkins