user316030
user316030

Reputation: 333

How can I know which version of WPF I am running?

I have discovered some differences between WPF 3.0 and WPF 3.5. As a result, I need to know if an assembly was compiled against 3.0 or 3.5. Is there a API for this?

Upvotes: 1

Views: 5018

Answers (3)

The Doctor
The Doctor

Reputation: 692

i didn't test this in .NET , but in NetFramework you can use referenced assemblies :

Assembly wpfAssembly = Assembly.GetAssembly(typeof(System.Windows.Application));
Version wpfVersion = wpfAssembly.GetName().Version;

Console.WriteLine("=========>> WPF Version: " + wpfVersion.ToString());

Upvotes: 0

Farmer
Farmer

Reputation: 11003

The version number for the current installed version of Windows Presentation Foundation (WPF) is located in the Registry.

To find the version number:

1.

  On the Start menu, click Run.

2.

  In Open, type regedit.exe.

3.

  Open the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\Windows Presentation Foundation

The WPF version number is stored in the Version value.

Upvotes: 3

Ken Henderson
Ken Henderson

Reputation: 2828

You should be able to determine this from the referenced assemblies of your targeted assembly. Take a look at MSDN to check out the GetReferenceAssemblies method of the System.Reflection.Assembly class.

Upvotes: 1

Related Questions