Silverlight_newbie
Silverlight_newbie

Reputation: 21

How to differenciate between Silverlight v2.0 and v3.0 assemblies

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?

Upvotes: 2

Views: 141

Answers (2)

Jeff Wilcox
Jeff Wilcox

Reputation: 6385

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.

Upvotes: 3

Henry Gao
Henry Gao

Reputation: 4936

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());

Upvotes: 0

Related Questions