Skip to content
⌘ NSIS Forum Archive

dotNet version detection problem

3 posts

sina_izad#

dotNet version detection problem

Hi there

i was having some problems with detecting the version of the dotnet installed.

i use this function to detect the dot net version installed. which works fine!

Function GetDotNETVersion
    Push $0
    Push $1
    
    StrCpy $0 0
    System::Call "mscoree::GetCORVersion(w .r0, i ${NSIS_MAX_STRLEN}, *i r2r2) i .r1"
    StrCmp $1 "error" 0 +2
    StrCpy $0 "not found"
    
    MessageBox MB_OK $0
    Pop $1
    Exch $0
FunctionEnd 
here is what happends

- i have dotnet version 1.1 installed
- i run installer which checks for version 2.0
- it senses that 1.1 is installed and runs the version 2.0's installer using execwait
- after installation dotnet is done i check the version using the above function and it still thinks that version 1.1 is installed

so there is noway for me to know if installation was successful

here is the interesting thing, if i run my installer again the first time it checks for latest version of dotnet it senses version 2.0 and continues happily ever after.

has anyone had the same problem? what is the work around?
to see if 2.0 was successfully installed? or is there a more reliable way to check for latest version of dotnet installed?

thanks
Sina
Afrow UK#
Yes there is. ExecWait has an extra parameter, i.e. ExecWait "...dotnetfx.exe ..." $R0

$R0 will be 0 on success or an error specific error code.

Stu
sina_izad#
thanx Afrow UK it works 😁

its nice that even if user cancels installation and dotnet installer exits gracefully it still receives some error