John T. Haller (Updated: October 24, 2013, Created: August 16, 2007)
A few people have asked about whether certain .NET-based applications can be made into portable apps. For the unfamiliar, .NET is a software component that provides a number of pre-built libraries as well as a runtime manager. Applications written with .NET require the proper version of the .NET runtime be installed in Windows to run. More details on what .NET is are available in the Wikipedia article on the .NET Framework.
Multiple Versions, Some Compatibility Issues
.NET is currently available in multiple versions (1.0, 1.1, 2.0, 3.0, 3.5, 4.0, 4.5 and 4.5.1), more if you count the various service packs. In many cases, applications written for one version of the .NET framework will work on a later version. In some cases, certain changes will break some applications or features, however. Microsoft refers to these as "Breaking Changes" (Example: 2.0 Breaking Changes). So, for example, some .NET 1.1 applications will run just fine on a PC with only the .NET 2.0 runtime installed whereas others will not run unless the .NET 1.1 runtimes are installed.
.NET Framework Runtime Bundling and Installation
The .NET Framework has been bundled with Windows for the last six years. Windows Vista first included .NET pre-installed (version 3.0 of the framework). Windows 7 includes version 3.5. Windows 8 includes version 4.5/4.0 but requires a download for version 2.0/3.0/3.5 and drops support entirely for 1.0/1.1. For earlier versions of Windows, the .NET runtime must be downloaded and installed on each PC by a user logged on with administrative privileges. The download size ranges from 50MB to up to 200MB depending on configuration and version. The .NET Framework is made available for direct download from Microsoft's website as well as Windows Update where it is listed as an optional update, meaning that it will not be installed by default unless patching an already-installed version (see screenshot). Most users only apply critical/high priority updates as these are the only ones Windows is configured to automatically apply. The installation process can take 15 minutes or more and requires closing all running programs and restarting the PC, so even in a situation with admin rights, installing and then removing is unreasonable.
Several people have also asked about whether .NET itself can be made portable. The answer is no. .NET is heavily tied to the Windows operating system and requires an administrator to install. Plus, it is a closed source, commercial product, so, legally, we couldn't do it, anyway. So, we're left with just analyzing what PCs already have it and what PCs can have it added.
.NET Framework Availability By Version and Operating System
Using the compatibility information by operating system, compatibility of .NET versions with each other, bundling information with operating system and some quick overview statistics of operating system usage online, I've compiled a quick chart that shows you where .NET can be expected, where it's available for download and where it simply won't work.
|% of Windows PCs||.NET Version|
|Windows 8/8.1||9.79%||Not Available||Download||Download||Download||Included||Included|
|Windows XP||34.60%||Download||Download||Download||Download||Download||Not Available|
|Windows 2000||0.03%||Download||Download||Not Available||Not Available||Not Available||Not Available|
|Windows NT||0.10%||Download||Not Available||Not Available||Not Available||Not Available||Not Available|
|Windows PCs With .NET Version Included||55.47%||50.38%||55.47%||51.09%||9.79%||9.79%|
|Windows PCs Compatible With .NET Version||90.21%||99.90%||99.87%||99.87%||99.87%||65.26%|
Statistics from Net Applications for September 2013 adjusted to include Windows PCs only.
* Compatible indicates that most apps written for this version of the .NET framework should work out of the box on this version of Windows with the exceptions of apps that fall afoul of the "Breaking Changes" as described earlier in this document.
For those curious about the numbers if we include Mac OS, Linux, FreeBSD and Solaris in the mix (assuming it is a straight .NET app without Mono compatiblity adjustments and will not work on non-Windows OSes), the numbers are as follows:
|All PCs With .NET Version Included||50.38%||50.38%||50.38%||46.39%||8.89%||8.89%|
|All PCs Compatible With .NET Version||81.92%||90.72%||90.69%||90.69%||90.69%||59.27%|
Today, your chances of encountering a PC equipped with the proper version of the .NET Framework are quite a toss-up. Most Windows XP PCs in public locations (net cafes, coffee shops, libraries, hotel business centers, school computer labs, etc) simply won't have .NET installed. Windows Vista and 7 machines in public locations will have .NET Framework 3.5 installed but may not have anything later, depending on how they have been updated. And Windows 8/8.1 machines will have support for version 4.0 and up pre-installed but likely won't support 2.0/3.0/4.5 without an administrator enabling it.
Of course, your personal results may vary greatly as you may be using a Windows 7 or 8 PC at home or you may have the .NET Framework installed at work due to corporate applications that require it. Overall, however, applications based on .NET simply can't be considered portable due to the fact that the files they need can't be bundled portably and won't be on a large number of PCs you encounter in the wild.