Scott Hanselman

SmallestDotNet Update - Now with .NET 4 support and an includable JavaScript API

February 09, 2010 Comment on this post [15] Posted in ASP.NET | ASP.NET MVC | Javascript | Learning .NET | Microsoft | Source Code | Tools | VS2010 | Windows Client | WPF
Sponsored By

A few years back I wrote a post on the size of the .NET Framework. There's historically been a lot of confusion on the site of the .NET Framework. If you search around on the web for ".NET Framework" or ".NET Framework Redistributable" you'll often get a link to a 200 meg download. That download is the complete offline thing that developers redistribute when they want to install the .NET Framework on any kind of machine without an internet connection.

The .NET 3.5 Client Profile is more like 28 megs and the .NET 4 Client Profile is a looking smaller than that, in fact. Back then I made this website, to help out. It'll sniff your browser's UserAgent and tell you want version of .NET you have, how big the download would be to get you to .NET 3.5 and what .NET redistributable is best for you in order to minimize your download.

Now that the .NET Framework 4 is coming out soon, I took an hour and updated it (with Tatham Oddie's help, as he's staying over at the house this week) to support the new framework. We also added a few bug fixes (and I'm sure, a few bugs) and a simple Javascript API to help you detect the .NET Framework on the client side.

You can use the site in three ways.

First, visit the site.

If you've got a machine you want to install .NET on, or you're not sure what version it has, just visit and I'll do my best to tell you. It works best on IE, but it'll also work on Firefox if you've got the .NET add-on. If you've got Safari or Chrome, I'll apologize but I can't help you as those browsers don't tell me anything about .NET.

Second, include the Javascript that spits HTML.

If you want to tell the user what version of .NET they have with minimal effort and you want to do it on your site, perhaps via your blog, you can just include this line:

<script type="text/javascript" src=""></script>

and I'll return something like:

document.write('<span class="smallerdotnet">')
document.write('Detected 3.5 SP1 .NET Framework. No update needed.')

and you can style to taste.

Third, include the Javascript that spits JSON.

The HTML spitter is fast, but less useful if you like control over things. Like, um, text. So, you can include:

<script type="text/javascript" src=""></script>

and I'll spit out a JSON object like this:

SmallestDotNet = {};
SmallestDotNet.latestVersion = {
major: 4,
minor: 0,
profile: "client",
servicePack: null
SmallestDotNet.allVersions = [
major: 4,
minor: 0,
profile: "client",
servicePack: null
major: 3,
minor: 5,
profile: "full",
servicePack: 1
major: 2,
minor: 0,
profile: "full",
servicePack: null

We'll put out the latest version of the .NET framework on the machine, as well as its Service Packs, and its profile (client profile, full, etc) if appropriate. It'll also give you an array of ALL the versions of the .NET Framework it finds on the machine. In my example, it says my machine has .NET 4 Client Profile, .NET 3.5 SP1 and .NET 2.0.

UPDATE: I've updated the JSON output to return another array with a complete list of all available .NET Frameworks and the URL they can be downloaded from, something like this:

SmallestDotNet.downloadableVersions =
major: 4,
minor: 0,
profile: 'client',
servicePack: null,
url: ''

major: 2,
minor: 0,
profile: 'full',
servicePack: 2,
url: ''
major: 1,
minor: 1,
profile: 'full',
servicePack: 1,
url: ''

I currently don't go into deep deep detail, like .NET 2.0 SP2, etc, but if you want that functionality, let me know and I can add it. This is a spike (ongoing for two years, actually) so if it's useful, let me know. If it's missing something, let me know.

From this JSON, you can ask all sorts of questions. Here's a JavaScript alert() example that would work on this JSON object. Of course, you should check things for null, as well as check the length of allVersions.

alert( SmallestDotNet.latestVersion.major ); 
alert( SmallestDotNet.allVersions.length );
alert( SmallestDotNet.allVersions[0].minor );
alert( SmallestDotNet.allVersions[1].major );");

It'd be cool to add some jQuery love to this and use it to give and end-user some nice feedback on what version of your application to install, or what version of .NET they should install first. It could also be useful for self-troubleshooting your application.

Hope this is useful. Enjoy.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
February 09, 2010 10:36
Great work Scott, really helpful! I specially loved the message you get when the app detected I already had the 4.0 framework.
February 09, 2010 16:23
what about german and other languages on ?
February 09, 2010 20:01
Really nice, Scott. Good job.
February 09, 2010 20:44
Great Post Scott
February 09, 2010 22:20
So internationalization is important, Thomas? For the site text and the js?
February 10, 2010 0:56
Great Scott. Thank you.
February 10, 2010 2:18

Thank you for providing SmallestDotNet and now this extended functionality. Every time I need to setup a server or work on a machine one of the first things I do is Google (sorry) smallest .net and verify the .NET install.


And on that note, isn't document.write() a no-no now days?
February 10, 2010 4:17
I would love to see the JSON also providing a list of download links in case I'm not up to date...
The links should be sorted from the smallest to the biggest download.
That way I have everything I need to build my own page without having.
Of course accompanied by the usual major, minor, profile, servicepack describing what it is so that I can tell the user to what he will upgrade if he follows my recommandations...
Because having the version info is one thing but knowing where to find the updates is another...
Thank you...
February 10, 2010 9:06
Jonx - I've updated the DOM to support a list of downloadable links, so you can programmatically decide what your user's need and give them the link directly.
February 10, 2010 20:27
It would be great if there were a version of the web installer that could be placed on a company's intranet and point to internal locations for the supporting installation files.
April 20, 2010 11:09
It is a good time to update the site( and add more browser support. :)
April 20, 2010 20:42
Soeleman - You'd need the .NET Assistant for Firefox if you wanted support for .NET in FF.
April 21, 2010 19:05
Hi Scott,

I tried it with FF, and was tellling me : "Detected FireFox. Add .NET Framework 3.5 SP1, only a ~10 meg download.". Should you update it to point to the 4.0 release instead?
June 28, 2010 12:17
Thank you Scott.
September 21, 2010 13:03
Great sharing.. Thanks for this Scott!

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.