开发者

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

开发者 https://www.devze.com 2023-03-13 01:45 出处:网络
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 tra

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 referen开发者_JS百科ce, 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?


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.


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.


You have checked the option Reuse Types? Try uncheck the option Reuse Types

0

精彩评论

暂无评论...
验证码 换一张
取 消