tags:

views:

154

answers:

1

Hi, I get the following error when I try to run my Silverlight application:

Line: 53 Error: Unhandled Error in Silverlight Application Code: 2106
Category: InitializeError
Message: Failed to load the application. It was built with an obsolete version of Silverlight

In "Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0" I have version 3.0.40307.0 installed but I also have the following 2 directories: - "Program Files\Microsoft Silverlight\3.0.40307.0" - "Program Files\Microsoft Silverlight\3.0.50106.0" And it's the 3.0.50106.0 version that is used by the browser.

How do I "tell" Visual Studio to target the 3.0.50106.0 version?

Best Regards, Jesper

A: 

If you're moving from SL2 to Silverlight 3, there were some breaking changes, one that might be biting ya:

System.Web.Silverlight.dll has been removed from the Silverlight SDK
In other words, replace <asp:silverlight> with the equivalent <object> tag.

Regarding telling it which to use, unless you're running VS2010, you can't multi-target Silverlight apps, so when you open a SL project it will be upgraded to whatever version you have installed.

You can check which version is being targeted by looking at the .proj file, check which dll's it's referencing (eg Microsoft SDKs\Silverlight\ v2.0 \Reference Assemblies\system.dll, Microsoft SDKs\Silverlight\ v2.0 \Reference Assemblies\mscorlib.dll, etc...)

Bobby
I'm running Visual Studio 2008 SP1 with Silverlight tools for Visual Studio 2008 SP1. The Silverlight project is referencing the 3.0.40307.0 version, is this the problem? Can't I run on a newer engine than the one it has been built on?
Krimson
did you check the ASP control I mentioned (easy fix to check), actually if you mean can you build Silverlight 2 (for example) applications when you have the Silverlight 3 SDK installed, then no - the projects will be upgraded when you load them in VS (unless you're trying to write SL3 apps in VS2010 beta)
Bobby
I don't think Silverlight 2 is an issue here. This is a fresh Virual Machine with Silverlight 3, Silverlight 2 has never been installed. I get the error when I create a new Silverlight application in VS, without making any modifications.
Krimson
ah, suppose I should have asked, did you use the Web Platform Installer?
Bobby
Nope, but I started over today and installed Silverlight Tools with Web Platform Installer 2.0, and it seems to work. But why I don't understand...
Krimson
yea, I have had problems with the order of things being installed causing problems in the installation - and having to start over with a fresh install.. which is what I was going to suggest next (using the WPI). Glad it's working for ya now :p
Bobby