Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9098731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:25:58+00:00 2026-06-17T00:25:58+00:00

Is there any way to avoid code generation for types that are already referenced

  • 0

Is there any way to avoid code generation for types that are already referenced when using multiple domains?

Let me explain.


I have an application infrastacture for silverlight application. This infra package includes 3 (RIA) domain services (authentication, logging, service discovery) on the server side – Infra.Web.dll and a silverlight dll – ClientInfra.dll that implements user authentication at the application start and some other base classes (like BaseApp and BaseView) while Infra.Web.dll is defined as WCF RIA Services Link for ClientInfra.dll.

Now I’m developping some demo silverlight application in order to test my infrastructura. I have created the

DemoApp.Web wich refernces the Infra.Web.dll (in order to get the infra services)

and 2 silverlight projects:

DemoApp.Data that defines DemoApp.Web.dll as WCF RIA Services Link in order to get the generated code and refrences ClientInfra.dll

DemoApp that is the actual silverlight application that refernces ClientInfra.dll

The problem is that when I try to use one of the RIA services from the silverlight application I’ve got an error that the Domain Service classes are defined both in ClientInfra.dll and DemoApp.Data. As far as I understand the problem is the code from Infra.Web.dll has been generated twice: first for ClientInfra.dll, second for DemoApp.Data.

Is there any way to avoid code generation for types that are allready refrenced like in my case where ClientInfra.dll allready has the generated infra services so there is no need to generate it again in DemoApp.Data?

I’ll try to make my question more simple. How can I avoid the ria services type generation (in silverlight) of types that have been already generated for my referenced dll? The type generation duplication causes an error CS0433 that the same types are defined in 2 different dll’s

I have found out some interesting fact. If I reference the ClientInfra.dll directly from the DemoApp (the silverlight application project) than the data types that have been alresdy generated in ClientInfra.dll are not generated once more. But if I reference the ClientInfra.dll from DemoApp.Data I do get the duplicated types code generation with a compilation warning that the same types are defined both in the referenced dll and in the generated code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T00:25:59+00:00Added an answer on June 17, 2026 at 12:25 am

    I have found the following in the msdn documentation

    Analyze all assemblies either built or referenced by the middle tier
    project for domain service classes, entity classes, or shared code.

    RIA Services checks the existing members before generating the proxy
    class. Any member that is already defined will not be generated in the
    proxy class.

    That means that my scenario should work as I have expected!

    In order to check the code generation process I set the MSBuild project to build output verbosity (Tool->Options->Projects and Solutions->Build and Run) to Normal (instead of default Minimal). Then after the compilation I discovered that the DemoApp.Data project had failed to load ClientInfra.dll that includes already generated proxies. So the generator just ignored it and generated all the classes from the beginning.

    I have solved this loading issue and everything works fine now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there any way to avoid using tmp table? I am using a query
is there any way to avoid using tmp table? I am using a query
Is there any way I can avoid using array_flip to optimize performance. I am
Is there any way to avoid the clutter of adding all the types to
Is there any way to avoid this kind of code when overwriting the default
Is there any way to avoid that Coffeescript compiles few rows? For example, I
I would like know if there's any way to avoid using the keyword @using
Is there any way I can set a formatter on models that will convert
Is there any way we can fetch X509 Public Cetrificates using c# from AD
In our .Net application, Excel is getting run. Is there any way to avoid

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.