Silverlight Project - teething problems

Silverlight Project - teething problems

Old forum URL: forums.lhotka.net/forums/t/7770.aspx


Jav posted on Monday, October 12, 2009

I have created a minimal Silverlight Solution closely following the NTier video, but using Csla 3.8.0 beta. I have added a Sever Library and a Client Library. In the Server Library I have the MyProject.cs and MyProject.Server.cs. Server Library references cslacs and Client Library references cslalightcs.

The problem is with the MyProject.cs The Using statements in the file are as in the Video (System, Csla, Csla.Serialization). The code in MyProject.cs is basically Business Methods, BusinessRules, Business Authorization regions. Everything compiles just fine until I include the MyProject.cs in the Client Library As a Link. The Build action after that gives me 4 puzzeling errors - all four referring to the Client Library. The Errors are:

1. 'SerializableAttribute' is an ambiguous reference between 'System.SerializableAttribute' and 'Csla.Serialization.SerializableAttribute'
2. The type or namespace name 'Serializable' could not be found (are you missing a using directive or an assembly reference?)
3. The type 'System.ComponentModel.IEditableObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
4. The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'

Obviously I am doing something wrong but I cannot figure out what.
Thanks for the help.

RockfordLhotka replied on Monday, October 12, 2009

Make sure you reference the correct Csla.dll in each project.

The Silverlight class library must reference the Silverlight Csla.dll, and the .NET class library must reference the .NET Csla.dll.

One way to narrow down the compile issues is to explicitly compile each project - right click on the project in Solution Explorer and say to build just that one project. I often find it challenging to figure out which project is failing to compile when building the whole solution, especially with this type of issue.

Jav replied on Monday, October 12, 2009

After comparing my Solution with the SimpleApp sample brick by brick, I discovered that the Type of my ClientLibrary project was wrong. I was using a Windows Class Library. When I deleted the project and created a new one of the type Siverlight Class Library, all errors have disappeared.

Thanks Rocky

skumarsamy replied on Wednesday, September 21, 2011

Hi,

I too have the same issue. I just use the same SimpleApp as model and created a sampeapp, in my server side business object whe i tried to use Serializable, this one refers to System.Serializable, not from Csal.Serialization. I tested all my libraries Csla from .NET, Client library has Csla from Silverlight, but unable to clear the issue. I tried to build individual projects has the same issue.

Looking forward for some help.

thanks

kumar

RockfordLhotka replied on Wednesday, September 21, 2011

It can be confusing to start.

You need to be very careful to use the right project types, and to reference the correct Csla.dll for .NET and for Silverlight (because they are not the same).

 

MadGerbil replied on Thursday, September 22, 2011

Just out of curiosity, would a version of CSLA for WinRT avoid these issue?   Shouldn't we be able to us the same library on the client and on the server side of an asynchronous operation?   Probably too early to tell, but it's a delightful thought.

RockfordLhotka replied on Thursday, September 22, 2011

MadGerbil

Just out of curiosity, would a version of CSLA for WinRT avoid these issue?   Shouldn't we be able to us the same library on the client and on the server side of an asynchronous operation?   Probably too early to tell, but it's a delightful thought.

Sadly no. In fact, it goes the other way. We'll have yet another version of Csla.dll to support WinRT, because it is a new platform - somewhat similar to SL, but definitely not the same... See this blog post: http://www.lhotka.net/weblog/CSLAOnWinRTProjectStart.aspx

And we'll have a Csla.dll for .NET 4.5, just like we have one for .NET 4 today. In fact it won't change much (the .NET one) other than to support some of the new 4.5 features. Such as:

And the existing Csla.dll for SL will continue to exist (but for SL5 of course), along with the one for WP7.5, and the one for iOS, and for Android, and for mono.

Copyright (c) Marimer LLC