0
votes

I have a Silverlight 4 RIA Services solution consisting of two projects, the first is the web host and RIA Services host web application. The second is the Silverlight client. I recently updated VS 2010 to Service Pack 1 and I suspect that has something to do with this problem, but I'm not sure. When building I am getting:

The type or namespace name 'ComplexObject' could not be found (are you missing a using directive or an assembly reference?)

This is being caused by a reference which inherits ComplexObject and exists in the RIA Host project but is dynamically added to the "generated_code" directory in the Silverlight client project when built.

ComplexObject is a member of System.ServiceModel.DomainServices.Client and that assembly, version 2.0.50727 is referenced by the Silverlight client so I'm not sure why it is complaining. It should be able to find that dependency.

Any help is appreciated. Thanks.

UPDATE: The using statements in the generated file are:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel.DomainServices;
using System.ServiceModel.DomainServices.Client;
using System.ServiceModel.DomainServices.Client.ApplicationServices;
1
What is the list of using RIA services generated for you in the .web.g.cs file? Is using System.ServiceModel.DomainServices.Client present?ken2k
Yes. See updated question for full using list.jayint32
Have you tried deleting the generated code and then compiling again?Bryant
Sorry for the delay. Yes, I have tried deleting the generated code and rebuilding. Get the same error.jayint32
I got past the error after I installed RIA Services V1 SP2. But now I'm getting the following: Type 'System.Data.Objects.ObjectContext' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types.jayint32

1 Answers

0
votes

It appears that the cause of the original error I reported

The type or namespace name 'ComplexObject' could not be found (are you missing a using directive or an assembly reference?)

was due to the fact that my project was referencing an earlier version of the RIA Services assemblies. After I installed RIA Service V1 SP2 I got past that error. Though I did get stymied by yet another one after that, serializing ObjectContext is bombing out, but I was able to at least build and start up the client.

Thanks ken2k and Bryant for your comments.