Get System Setting Windows Vista into NET2SP2_ISVISTA
if Variable NET2SP2_ISVISTA Equals TRUE
  Comment: On Vista, read a file version to determine the .NET 2 SP2 installation state
  Get Folder Location System->Windows Directory into NET2SP2_WINDIR
  Check File Version $NET2SP2_WINDIR$\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll into Variable NET2SP2_FILE
  if Variable NET2SP2_FILE Equals TRUE
    Set Variable NET2SP2 to TRUE
  else
    Set Variable NET2SP2 to FALSE
  end
else
  Comment: On legacy OS'es, read the registry to determine the .NET 2 SP2 installation state
  Read Registry Key HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727\Version into NET2SP2_REGISTRY
  if Variable NET2SP2_REGISTRY not Greater Than (Version) 2.2.30728
    Set Variable NET2SP2 to FALSE
  else
    Set Variable NET2SP2 to TRUE
  end
end
if Variable NET2SP2 Equals FALSE
  Get System Setting Windows 2003 into NET2SP2_IS2003
  Get System Setting Windows XP into NET2SP2_ISXP
  Get System Setting Service Pack 1 into NET2SP2_SP1
  Get System Setting Service Pack 2 into NET2SP2_SP2
  if Variable NET2SP2_ISVISTA Equals FALSE
    if Variable NET2SP2_IS2003 Equals TRUE
      if Variable NET2SP2_SP1 Equals FALSE
        Comment: .NET 2.0 SP2 requires Service Pack 1 on Server 2003
        MessageBox: $TITLE$ Setup, $TITLE$ requires at least Service Pack 1 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
        Terminate Installation
      end
    else
      if Variable NET2SP2_ISXP Equals TRUE
        if Variable NET2SP2_SP2 Equals FALSE
          Comment: .NET 2.0 SP2 requires Service Pack 2 on XP
          MessageBox: $TITLE$ Setup, $TITLE$ requires at least Service Pack 2 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
          Terminate Installation
        end
      else
        Comment: .NET 2.0 SP2 is not supported on older Windows versions
        MessageBox: $TITLE$ Setup, $TITLE$ requires at least Windows XP or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
        Terminate Installation
      end
    end
  end
  Set Variable PREREQ to TRUE
  Set Variable PRELIST to $PRELIST$$NEWLINE$Microsoft .NET Framework 2.0 Service Pack 2
end
 
