How to Automatically download and install a particular version of .NET if it is not already installed

From NSIS Wiki

Contents

Introduction

Here's a breakdown of my requirements:

Check if .NET 1.1 is installed

If it is installed do nothing

If it is not installed, download it and install it automatically

I thought my requirements were simple and *should* apply to *any* other .NET developer out there so i was surprised that i could not find this solution already on this site.
I arrived at my solution thanks to 3 other articles. By mashing the concepts from those articles together i got what i wanted.

Mashing it all together

Using the script is simple. Just define 2 variables in your main script that indicate the minimum version required. This example is setup to for .NET 1.1

If you wish to require a different version 2 steps are required

Modify the !define statements to the major and minor version numbers you require

Modify the download URLs to point to the proper installer executable for download from Microsoft's website