SmallestDotNet Update - Now with .NET 4 support and an includable JavaScript API
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,SmallestDotNet.com 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 SmallestDotNet.com 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="http://www.smallestdotnet.com/smallestdotnet/javascript.ashx"></script>
and I'll return something like:
document.write('<span class="smallerdotnet">')
document.write('Detected 3.5 SP1 .NET Framework. No update needed.')
document.write('</span>')
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="http://www.smallestdotnet.com/smallestdotnet/javascriptdom.ashx"></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: 'http://www.microsoft.com/...'
},
...SNIP...
{
major: 2,
minor: 0,
profile: 'full',
servicePack: 2,
url: 'http://www.microsoft.com/...'
},{
major: 1,
minor: 1,
profile: 'full',
servicePack: 1,
url: 'http://www.microsoft.com/...'
}];
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.
About Newsletter
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.
Invaluable.
And on that note, isn't document.write() a no-no now days?
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...
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?
Comments are closed.