Archive: DotNetVer.nsh - another way of checking MS.Net version


DotNetVer.nsh - another way of checking MS.Net version
Hi all,

I know that there are a couple of methods in the wiki for determining the existence and version of Microsoft.Net, but not one of them covered everything I needed and I found them a little messy.

I have created a header file, for purely determining the existence and version of dotNet. I liked the cleanliness of the WinVer header, and decided to base DotNetVer off that.
Thanks to a little help from the community, it checks for DotNet 1.0 to 4.0, their service packs and types of installation.

Thus DotNetVer.nsh is a LogicLib extension for checking Microsoft .NET Framework versions and service packs.

"HasDotNet<version>" checks if the specific version of .NET framework is installed.

<version> can be replaced with the following values:

1.0
1.1
2.0
3.0
3.5
4.0

"AtLeastDotNetServicePack" checks if the .NET framework has a service pack version at least as specified.
"IsDotNetServicePack" checks if the .NET framework has a service pack version exactly as specified.
"HasDotNetClientProfile" checks if the .NET framework is a client profiled install.
"HasDotNetFullProfile" checks if the .NET framework is a full install.


Usage examples:

${If} ${HasDotNet4.0}
DetailPrint "Microsoft .NET Framework 4.0 installed."
${If} ${DOTNETVER_4_0} AtLeastDotNetServicePack 1
DetailPrint "Microsoft .NET Framework 4.0 is at least SP1."
${Else}
DetailPrint "Microsoft .NET Framework 4.0 SP1 not installed."
${EndIf}
${If} ${DOTNETVER_4_0} HasDotNetClientProfile 1
DetailPrint "Microsoft .NET Framework 4.0 (Client Profile) available."
${EndIf}
${If} ${DOTNETVER_4_0} HasDotNetFullProfile 1
DetailPrint "Microsoft .NET Framework 4.0 (Full Profile) available."
${EndIf}
${If} ${DOTNETVER_4_0} HasDotNetFullProfile 0
DetailPrint "Microsoft .NET Framework 4.0 (Full Profile) not available."
${EndIf}
${EndIf}


Code: Download from GITHUB https://github.com/dgrinberg/NSIS_headers
Hompage: http://ontheperiphery.veraida.com/


Please feel free to use and modify as you see fit. If you find any issues, let me know and I will have a look - alternatively you can fork it on GITHUB and then push any changes back to me.

Thanks all

David Grinberg


Nice work. It would be helpful if you could upload to the NSIS Wiki.

Stu


Thanks for the work, I'm sure lots of people will be helped by this. I didn't look in detail at your macro, but I'd suggest to use the same format for the ${Has} defines and the more elaborate ${VER} defines. So if you have ${HasDotNet4.0}, it may be better if you'd use ${DotNetVer4.0} instead of ${DOTNETVER_4_0}.


nice job !
If framework (4) was not install
Have you the code to download it and install it ?
thanks