How to know which .NET framework servicepack version is used ?
-
Hi all, Under my machine I have installed .Net framework v1.1, v2.0 and v3.0 How can I know which version is being used by my applications ? Thanks
Hi, this is only a partial answer to your question:
string s=Environment.Version.ToString(); if (s=="1.1.4322.573") s=s+" (= 1.1 without Service Packs)"; else if(s=="1.1.4322.2032") s=s+" (= 1.1 with SP1)"; else if(s.StartsWith("1.1.")) s=s+" (= unknown 1.1 flavor)"; else if(s=="2.0.50727.832") s=s+" (= 2.0 without Service Packs)"; else if(s=="2.0.50727.1433") s=s+" (= 2.0 with SP1)"; else if(s.StartsWith("2.0.")) s=s+" (= unknown 2.0 flavor)"; Console.WriteLine(s);
It lacks information on 1.0, 3.0 and 3.5, and does not answer the question from outside the app. I too would like to know how to programmatically ask an EXE which Framework it needs without launching it. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
-
Hi all, Under my machine I have installed .Net framework v1.1, v2.0 and v3.0 How can I know which version is being used by my applications ? Thanks
The question is complicated by the fact that version 3.0 and 3.5 do not update the JIT compiler nor the base class libraries. Officially, anyway - 3.5 shipped simultaneously with (and requires) 2.0 SP1 which does update the CLR and BCL. To determine the version of the CLR required, you can use the Assembly.ImageRuntimeVersion property, if you load the assembly using reflection. To determine if libraries from 3.0 or 3.5 are required you will need to use GetReferencedAssemblies and inspect the assemblies that are being loaded.
DoEvents
: Generating unexpected recursion since 1991