Hi all. First, thanks in advance for any assistance you can offer!
Here is my situation: I am trying to, in essence, convert a C# console app to Silverlight (by using Silverlight as the UI). I'm having little or no trouble with the Silverlight end, but I need to be able to add two C# projects to the Silverlight solution so I can access certain classes, methods and data structures. I've added these csproj files, but even if I add
...

using namespace1.code.detail;
using namespace1.code;

To a page in the Silverlight project, I get the compile-time error:
The type or namespace name 'namespace1' could not be found (are you missing a using directive or an assembly reference?)

I've tried also adding the individual projects as references to the main, Silverlight project; but doing that gives me the error:

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

Does Silverlight disallow addition of external C# project references? Can you recommend a work around?

Again, thanks for any help you can provide.

Recommended Answers

All 2 Replies

I think the error message is pretty clear, there-- you can only add references to Silverlight projects in Silverlight projects. Silverlight uses a subset of the .NET Framework, so you can't import in projects that use libs outside of that limited subset.

The only way you could really get around this is to build a web service with the functions you need, as Silverlight can hit web services.

Oh, I see... Thanks for you help! It was the wording of the message that threw me off... I read it to be that I could only add references to the Silverlight project - which was what I was doing; not that I could only add Silverlight references to the Silverlight project. Guess I was seeing what I wanted to see :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.