Deployment Solution

 View Only

Detecting Which .NET Frameworks are Installed Using Wisescript 

May 09, 2011 02:56 PM

The code developed for this article is based on a Microsoft technote which can be found here: http://msdn.microsoft.com/en-us/kb/kbarticle.aspx?id=318785

It is not uncommon for an MSI installation to require a specific version of a .NET framework to be installed beforehand. Due to the frequent requirements for this to be done using a silent install (thus no pre-requisites can be installed via the UI sequence of an MSI), the next best option is to compile the MSI to EXE format and include the version of .NET as a pre-requisite.

However, the existing Wisescript stub wrapper that is used to generate the EXE from the MSI tends to fall out of date quite quickly, and also has limited abilities in detecting all current .NET frameworks.

The attached WSE and the associated EXE represent a code segment developed from the Microsoft technote that can be added into Wisescript projects including the EXE stub, to facilitate the correct identification of .NET installs and the associated service pack level. This in turn will ensure that the install can avoid an unnecessary reinstallation of a pre-requisite which is already present on the system.

Since the current .NET 4 framework is still at its original release, there are no SP entries in the associated registry keys, but I have assumed that service pack 1, whenever it is released, will create this key and set it to 1.  I have thus added in some code that in the absence of the SP registry key, will set the returned service pack level to 0, if the .NET framework is installed.  I have also added code to explicitly retrieve the version information although the consistency of this is unclear where service packs are involved.

The wisescript code includes a variable called CONTEXT which can be set to MANUAL or CA, allowing the code to be used as an MSI custom action if required.  The EXE is compiled with this variable set to MANUAL, so can be used as a simple standalone .NET version check utility.

If you prefer VBScript to Wisescript, my other article on this topic can be found at: 

https://www-secure.symantec.com/connect/articles/detecting-which-net-frameworks-are-installed-using-vbscript

Statistics
0 Favorited
0 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
zip file
WSE-NetVer.zip   146 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Related Entries and Links

No Related Resource entered.