C# – Why I can’t add a class library project reference to a Silverlight project

cnetreferencesilverlightsilverlight-4.0

I am a newcomer to Silverlight and while I have been following some tutorials I wanted to create a new project with a class library so that I can use it from my page's xaml.cs code behind.

But when I tried to add my class library project I get a warning message saying:

You can only add project references to
other Silverlight projects in the solution

It is clear what it says. But what is the reason behind this? Why I cannot add a class library project reference to a Silverlight project?

Thanks

Best Answer

Instead of regular Class Library, you can use the "Silverlight Class Library" template. The reason why you can't use a regular Class Library is that the Common Language Runtime of Silverlight is different than the CLR of "regular" .NET Framework.