views:

78

answers:

2

Have written all the code in a silverlight class library (dll) and linked this same library to my web app and silverlight app, is there a way to avoid the "Compiler Error Message: CS0433" or do I have to create a separate dll for the web app?

Error mostly occurs when XElement is called...

A: 

Do you mean you are referencing a single dll from both the web app and the Silverlight app? I would have two versions of the dll (and two project files); one built for regular .NET (for use in the web app), and one for Silverlight; the main difference being the target framework and the references.

If you don't want to deal with having to maintain two project files (when you add classes etc), then you can use this trick to reduce this overhead.

Marc Gravell
It works when I create two dll's but was wondering if you could do it from one..
Fredrick
I honestly don't know - but why risk it? Eventually you're going to get bitten by one of the many subtle differences between the two frameworks...
Marc Gravell
A: 

You need to create two projects, but can add the same CS file using Add Existing Item as a Link. http://msdn.microsoft.com/en-us/library/9f4t9t92.aspx explains it.

http://www.scip.be/index.php?Page=ArticlesNET28 is a nice read with related info.

Khurram Aziz
Actually thats the way I was doing it... needed to know if its the efficient way..
Fredrick