1

I'm starting a new project that is primarily a silverlight web application. However, it also needs to run as a stand-alone desktop application.

I'm planning on basing the project on Prism 4.0. It provides guidance around sharing code between silverlight and WPF for a "multi-targeted" application. If I understand correctly, I can use MVVM to create separate silverlight and WPF views for the same view-models and underlying services.

I'm wondering though if it is really worth the extra work to create the extra views, when silverlight can now be run as an out-of-browser application. Couldn't I bundle the desktop version of my app with IIS Express and host the silverlight app locally? It seems like a fairly easy thing to do. I'm sure there are some visually compelling things I can do differently in WPF, but in my case - the web version is where 90% of the usage is going to be, so the focus is clearly on silverlight. If we have to maintain two separate sets of views, I can see the WPF version trailing behind the silverlight version on a regular basis.

On the data side of things, I've already figured out that I can configure Entity Framework to work with SQL CE 4.0 for the desktop version. I would do this even if we used WPF, so it's really just down to the presentation layer.

So to recap, the question is simply this: Is IIS Express + Silverlight OOB a viable alternative to multi-targeting both Silverlight and WPF?

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575

2 Answers2

2

More than likely, the Silverlight-only version setup would be better, as long as you can live with the sandbox restrictions. Less distinct code to test is always a Good Thing. You haven't specified what the app is doing, but as long as it doesn't need access to (most) local devices, unrestricted filesystem access, or any of the other SL4 sandbox restrictions (which you could also get around with COM interop, but ouch), you should be fine just doing one version of the app with in- and out-of-browser deployment setups.

nitzmahone
  • 13,720
  • 2
  • 36
  • 39
  • Line-of-business app. Interaction with SQL via UI, and occasional messaging via email or web service calls. No local files or devices, so the sandbox should suffice. – Matt Johnson-Pint Apr 15 '11 at 18:00
  • Cool- presumably you'll be using RIA Services or naked WCF to remote the DB access, so "Silverlight only" sounds like a no-brainer to me... – nitzmahone Apr 15 '11 at 18:10
  • Yeah, me too. I was just surprised by lack of any recommendations of this approach by Microsoft. They tout Silverlight OOB, but nowhere do I see bundling it with IIS Express to host services. Perhaps this part isn't neccessary? I could just host silverlight in a static html page and host the WCF services in my own Windows Service, couldn't I? Can RIA services be hosted this way, or just naked WCF? – Matt Johnson-Pint Apr 15 '11 at 20:06
  • Yeah, self-hosting is supported by RIA. I half considered recommending that, but you'd still need something to serve up the Silverlight and host pages from the same host/port (ie, the "static page" approach would still need to be served, not just a file on disk). Or maybe not- OOB might support off-domain access, can't remember offhand. You can make naked WCF serve that stuff up easy enough (even easier with the WCF Pipeline stuff that just came out). – nitzmahone Apr 15 '11 at 20:52
  • 1
    When running silverlight OOB with full trust, there are no cross-domain restrictions. – Matt Bridges Apr 16 '11 at 00:39
  • Ah thanks- I was too lazy to look it up on a comment... Apparently only people named "Matt" can participate in this thread. :) – nitzmahone Apr 16 '11 at 01:04
1

A silverlight out of browser app sounds perfect for your needs. Rather than trying to bundle IIS express and SQL CE, you might want to take a look at something like SterlingDB for local data storage. If you are calling web services, out-of-browser applications running with the "full trust" flag enabled don't have cross-domain restrictions. This way, your app would be pure silverlight, and your deployment & update scenarios would be very straightforward (single-click install via a website).

Matt Bridges
  • 48,277
  • 7
  • 47
  • 61
  • Sounds like I don't need iis express, just a full trust silverlight oob. But I think I will still need a service host, and the can talk to SQLCE in the desktop version. If I go with Sterling, I won't have a provider for my EF entities, right? Remember, the main version of the app is web based with SQL server backend. I don't want to code twice. – Matt Johnson-Pint Apr 16 '11 at 04:27