1

Is it possible for a Silverlight project within a .NET solution to use methods, objects and what nots within other .NET projects?

@all, thank you for all of the response. My solution in my mind is to have a project with in the .NET solution that listens to a certain port and send an XML object based on the input. And have a separate Silverlight project that sends the query to the previously mentioned .NET solution port.

Do you think that it is possible without too much overhead? I don't even know you can make TCP connection with Silverlight...

1
  • @Angel: He's asking about Silverlight vs .Net interop. Commented Aug 1, 2011 at 13:40

3 Answers 3

2

No, because the Silverlight code is executing within the secure runtime environment inside the user's browser, some of the regular .NET features, such as COM Interop (a way to access Windows libraries) is disabled for security reasons.

If from your Silverlight code you need to access local resources (exposed via Windows APIs), you will need to create an Active-X control (for Internet Explorer, other methods exist for different browsers) which is written in C++ and can access all resources on the user's computer. You can then interact from your Silverlight control with that Active-X control using Javascript (called from Silverlight).

Sign up to request clarification or add additional context in comments.

1 Comment

+1, however I must ask if XAP xan hold a managed dlls package isnt there any way we specifically run its "setup" in full trusted zone assuming we are on an Intranet? Just like we can do that for XBAPs?
2

Manually maintaining the links between files in multiple projects using Visual Studio is possible, but it can be time consuming and error prone. For this reason, the Composite Application Guidance for WPF and Silverlight provides the Project Linker tool.

Project Linker: Synchronization Tool

2 Comments

can this apply to the project that is already developed .net? It seems like linker needs to be set before the dev to take advantage of.
this is from same link above Currently, the Project Linker works with any project type that you want. Keep in mind that linking between incompatible kinds of projects, such as between a Workflow project and a Silverlight project, is allowed, but it might lead to compile errors.
1

Off the top of my head here are a few ways to reuse code (not binaries) across Silverlight/.NET libraries:

  • You can use the Add existing File "Add as link" option to bring source code files into Silverlight (assuming the using statements are compatible)
  • You can use RIA service libraries to have code shared between server libraries (which are standard .NET libraries) and Silverlight clients. As well as the auto-generated RIA data stuff, there is a feature where you just name your files whatever.***shared***.cs, and it will be copied to the matching client library.

Unfortunately, you cannot just link with non-Silverlight binaries as it uses its own version of .NET.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.