tags:

views:

70

answers:

2

I see that assemblies compiled with Silverlight SDK v2.0 as well as v3.0 both reference v2.0.5.0 of mscorlib.dll, system.dll, etc.

How do I determine that assembly X is a v2.0/v3.0 assembly?

A: 

If you add this dll to visual studio, you can right-click the property, the run-time version will tell you.

You can also write a program to load and see. such as..

    // now get an external assembly
    AssemblyName anm = AssemblyName.GetAssemblyName( 
     "c:\\winnt\\microsoft.net\\framework\\v1.0.3705\\mscorlib.dll");
    // and show its version
    Console.WriteLine(anm.Version.ToString());
Henry Gao
This does not help at all!Both versions of Silverlight have the mscorlib at 2.0.5.0.
Silverlight_newbie
why you care? If both have the same mscorlib at 2.0.5.0, they are the same. it will not be different just because v2/v3 silverlight.
Henry Gao
Well, I have my reasons. And they are not the same - they have different sizes. Does anybody else know the answer?
Silverlight_newbie
+3  A: 

I'd recommend avoiding the implementation of any kind of "quirks-mode" for controls or applications based on the Silverlight version... it can become a maintainence nightmare.

What happens when Silverlight 4 comes out, for instance? What if the next release fixes some behavior that you customized for a Silverlight 3 issue?

It is correct that Silverlight 2 and 3 assemblies all have [AssemblyVersion(2.0.5.0)] fixed, making this difficult :-(.

To attempt to answer: you could use public reflection to examine a UIElement. Get a UIElement's Type, and look for something that was added in Silverlight 3, such as mouse wheel support's MouseWheel event on UIElement. Again, I wouldn't recommend it, but you could do it.

Jeff Wilcox
What was the reason to keep the AssemblyVersion unchanged? To allow SL3 plugin to support SL2 xaps/dlls?
AnthonyWJones
We're pretty serious about compatibility moving forward, and fixing the version number means that future releases can continue to run previously built assemblies without a painful rebuild, and without type forwarders, etc. It isn't perfect, and scares me, but it is what it is for now.
Jeff Wilcox