joeware - never stop exploring... :)

Information about joeware mixed with wild and crazy opinions...

I don’t know what time it is… Nor what .NET framework versions I have loaded…

by @ 12:32 pm on 4/6/2008. Filed under tech

A man with one watch knows what time it is; a man with two watches is never quite sure.

I was thinking of this quote the other day as I was trying to figure out what version(s) of the .NET framework were loaded on a Windows Server 2003 Server[1]. I had an application that said it wanted the 2.0 framework, I ran the 2.0 framework installer that came with the app and it said it wasn’t compatible with the version loaded. So I asked the simple question, well wtf is loaded?

I thought this is an easy question right? .NET is supposed to be a component of the OS, etc. I look in control panel and I see something for .NET 1.1 but nothing else, I run it, maybe it is just named poorly… Nope, just 1.1 stuff.

I googled for an answer, I keep finding “look at this and that DLL” or “look at these reg keys” or “look for these subfolders” and I am like, that can’t be right. Let me ask some of my friends…. Smart friends, I mostly have very smart friends, I really enjoy talking to smart people and I have been lucky enough to have a lot of smart people in my life.

In the responses back I received several methods… And they didn’t seem to align with each other… I didn’t know what framework versions I had loaded. I still really don’t…

Method #1:

Look at the subdirectories under %windir%\windows.net\framework

HKEY_LOCAL_MACHINE\software\microsoft\.netframework\v2.0 SP1
HKEY_LOCAL_MACHINE\software\microsoft\.netframework\v2.0.50727
HKEY_LOCAL_MACHINE\software\microsoft\.netframework\v3.0

Method #2

Look for the file mscorlib.dll under %windir%\windows.net\framework

C:\WINDOWS\microsoft.net\framework\v1.1.4322\mscorlib.dll
C:\WINDOWS\microsoft.net\framework\v2.0.50727\mscorlib.dll

Method #3

Look for .NET in output from wmic product (snipped at … on each line for readability)[2]

Microsoft .NET Framework 3.0 Service Pack 1 Microsoft .NET Framework 3.0 Service Pack 1 …
Microsoft .NET Framework 2.0 Service Pack 1 Microsoft .NET Framework 2.0 Service Pack 1 …
Microsoft .NET Framework 1.1 Microsoft .NET Framework 1.1 …

Method #4

Look at entries in registry

HKEY_LOCAL_MACHINE\software\microsoft\.netframework\v2.0 SP1
HKEY_LOCAL_MACHINE\software\microsoft\.netframework\v2.0.50727
HKEY_LOCAL_MACHINE\software\microsoft\.netframework\v3.0

Method #5

Looking at Add/Remove programs

Microsoft .NET Framework 1.1
Microsoft .NET Framework 2.0 Service Pack 1
Microsoft .NET Framework 3.0
Microsoft .NET Framework 3.0 Service Pack 1

 

So let’s tally the results shall we… Excuse the format, no table formatting in this version of livewriter…

Version                   Count                % sources

Version1.1                  3                        60%
Version 2                    3                        60%
Version 2 SP1             4                        80%
Version 3                    3                        60%
Version 3 SP1             2                        40%

 

Yes I still don’t authoritatively know what versions of .NET I have loaded. I am relatively confident I have 1.1 because I see icons for it in Control Panel, I am a little more confident I have Version 2 SP1 as well since almost all of the sources of what I have said I have it. I won’t even guess on the rest.

 

So I figured that maybe I could look at one of MSFT’s big new management tools, PowerShell (PoS) and it would show me… well if it does, I couldn’t find it[3] in the 5 minutes of looking I spent. It seems like it would at least tell me what it thinks it is using possibly.

 

Does anyone else other than the friends I spoke to in IM think this is a lot harder and indeterminate than it should be for something alleged to be so important in the OS? Honestly, there should be a simple command that I run from the CMD that tells me, why yes, you have these versions of the framework loaded… I found some code that will allegedly enumerate framework versions but it was .NET code… Firstly I shouldn’t have to compile something to do this since again, it is allegedly so important to the OS (recall Windows Server 2003 had an initial name of Windows .NET Server and then Windows 2003 .NET Server). Second, most people can’t compile code period. Oh yeah thirdly, it shouldn’t have to be .NET code… What if I don’t have the right framework to run it?

This is still a simple example, I have no doubt that on Windows Server 2008 this is more complicated since yet another version is likely in place and we haven’t even looked at x86 versus x64 versions… How much more complicated will that make it?

 

Again this should be simple. Why isn’t it? At this point I will take a button on System Properties that tells me the .NET frameworks that are available on the system. I think at this point we have learned enough about things to know that knowing versions on a system could be useful info for people debugging things or looking at requirements for an application, etc. Arguably developers who write apps that run on this framework should have code that checks when it is installed to see if the pre-reqs are there, but lets be realistic, I don’t even expect MSFT software to truly do that let alone third parties.

 

Another topic I am not even go deep into but was sent to me is version numbers in .NET and what they mean… I had some knowledgeable people who thought version number increases meant CLR changes… Not so says Scott – http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx

Add features, rev the major version number??? To me that would be like changing AdFind’s major rev number for added features. I would be up on like Version 30-something for AdFind… V37.0.0… With the same core code… That just doesn’t sit with me right. I wonder what happens with the version number when the CLR does receive some changes? Call it something else entirely?

 

    joe

 

 

[1] God I hate that name, see how awkward that was to type and to read out loud – MSFT get off the model year methodology for naming OSes, at least for Servers, I don’t give a frack what you name your Client OSes… Servers should be something like Windows 7.x.x, Windows 8.x.x, Windows 9.x.x…

[2] Funny IM chat about this when my friend told me about it and I made an observation…

  • Me: lol, wmi* = “this isn’t fast”
  • Me: They were trying to get us ready for .NET
  • Friend: nod, ironic we’ve actually found something slower that what we’re trying to determine the version of
  • Me: hahahahaha

[3] As a side note I find it annoying that it doesn’t handle dir /? very nicely.

Rating 3.00 out of 5

2 Responses to “I don’t know what time it is… Nor what .NET framework versions I have loaded…”

  1. joe says:

    I received a couple of emails about, hey you have seen .NET code to enumerate the versions?? Yes, you can find it here

    http://blogs.msdn.com/junfeng/archive/2005/07/07/436755.aspx

    Note I didn’t look the code over nor test it.

  2. Ryan says:

    Scott’s post covers a great deal, but the short version is that there are only two versions of the CLR: 1 and 2. Most people only care about 2.0 these days. The additional versions 3, and 3.5 are nothing more than layering over the 2.0 version.

    So, iff you see that you have 3.0 installed, you know that you also have 2.0 installed. Quick cheat sheet:

    2.0 == core CLR and BCL
    3.0 == WPF, WCF, WF, and CardSpace
    3.5 == LINQ, C# 3.0 features, updates to WCF, WF, and more

[joeware – never stop exploring… :) is proudly powered by WordPress.]