3

What I want to do

I've been playing around with the newly released Silverlight 5 and Silverlight 5 Toolkit (December 2011), and I would like to try deploying my 3D Silverlight test application to a third-party hosting server (AppHarbor in my case, but I'm open to other options).

My test application is simply the default Silverlight 3D application that you get when you create a new Silverlight 3D app:

It looks like AppHarbor (and most other hosting sites) require that you copy the required Silverlight 5 DLLs into your project, because they don't have the required SDKs/Toolkits installed on their servers.

Seems fine in theory, but I have no idea how to actually do this with Silverlight.

The problem

The problem is two-fold:

  1. I'm not sure exactly which DLLs need to be manually copied into my project, and I'm not sure how they should be included and referenced.

  2. After some experimentation with copying a few of the Silverlight XNA DLLs into my project and referencing the local project DLLs (instead of the SDK-installed and Toolkit-installed DLLs), the basic 3D Silverlight app now crashes when I run it in the browser -- locally. (The Silverlight plugin crashes.) I didn't have this problem before I started fiddling with the references and DLLs; the default project works just fine. So I haven't even gotten to deploying to a hosting server, because it no longer runs locally.

An aside

On the latter point above (Silverlight plugin crashing), the issue seems to be related to the 3D Silverlight functionality, which apparently requires elevated trust/permissions -- admittedly, I don't fully understand how that all works yet.

Generally speaking -- irrespective of all of this DLL/reference fiddling -- it seems like I need to check "Require elevated trust when running in-browser" in the Silverlight3dApp project properties to get the spinning 3D cube app to show up in the browser. Alternatively, if I leave that unchecked, I need to manually right-click the Silverlight 5 app in the browser and enable 3D graphics on the Permissions tab. (Side note: I'm interested in how this will effect my end-users if I ever do get this deployed. Will they have to manually adjust permissions in the same way? Anyway, that's a question for a different day.)

The point of this aside:

  1. The Silverlight plugin does not crash if I leave everything the way it is by default.
  2. If I copy the Silverlight DLLs into my project and reference them locally, the Silverlight plugin crashes if 3D permissions are enabled.
  3. If I copy the Silverlight DLLs into my project and reference them locally, the Silverlight plugin does not crash if 3D permissions are disabled.

The question

Has anyone successfully deployed that basic Silverlight 5 3D app to a server without Silverlight 5 (and the Silverlight 5 Toolkit) installed?

How did you do it? What files need to be copied into my project and referenced locally? Which references (if any) need to be removed?

Sub-question: If anyone has any insights about the elevated trust/permissions issue, I would love to hear those as well.

Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
Michael
  • 1,968
  • 4
  • 24
  • 40

3 Answers3

5

For AppHarbor I create a folder in the Silverlight project (lib) and copy all assemblies that I am dependent on and mark all the assemblies with copy to output.

Next I use subst to make a virtual drive that points to this folder and I add all the references to the assemblies on that virtual drive. (This is not needed for AppHarbor but this way I can check out my code to any folder on any machine I want without messing up the paths)

Note that you also need to add these dll's to the repository (git/mercurial) because a standard .hgignore file will skip the *.dll files.

Emond
  • 50,210
  • 11
  • 84
  • 115
0

Have you verified you are running the latest runtime for Silverlight? Did you have a previous developer runtime installed? http://www.microsoft.com/getsilverlight/get-started/install/

Roger
  • 2,063
  • 4
  • 32
  • 65
  • Thanks for your response. When I visit that page, I see this: "The version of Silverlight installed is: Silverlight 5 (5.0.61118.0)", so it looks like I'm up-to-date. – Michael Jan 03 '12 at 20:42
0

Hmm... I'm going to go with the above answer. I'm using the latest Silverlight 5 runtime and Silverlight 5 Toolkit and have not had any issues. Here's an app where I'm loading and animating an FBX model in Silverlight (it does require you to right click and set the permissions) and it works fine:

http://www.dustinhorne.com/necodecamp.html

As an aside I'm wrestling with whether to run in elevated trust or force the user to allow 3D acceleration. Personally I hate making the whole app elevated trust just for the 3D stuff from a security standpoint, although if you want to run it out of browser you may want to do that anyway and sign the app with a code signing certificate.

  • Yes! The 3D permissions thing is very annoying. I can't believe there's not a little user-friendly permissions popup (a la requesting webcam permission). Can you explain more about what you mean by "run in elevated trust"? Is there a way to use 3D without making the user go through a bunch of complicated permissions changes? – Michael Jan 06 '12 at 19:56