I have nsis package that consist of 3 items: 1. .Net 4.0 setup 2. C++ redistr 3. My App
My installer is always silent. In this package I check installed version of .Net and C++ and install from my package if I have bigger, but if user have correct version of net and c++, my package just export my app to temp folder and run it.
To install .net or c++ user must has admin rigths, but to run my app it is not needed. I don`t want always request admin rigths with RequestExecutionLevel admin
It is possible some how implement such logic in package:
IF (user_has_net != true || user_has_c++ != true) {
RequestExecutionLevel admin
} else {
RequestExecutionLevel user
}
The RequestExecutionLevel
property is set for your installer at compile time and is embedded in the installers manifest. It can't be set at runtime.
The best workaround I can think of in your case would be to embed another installer that handles the C++ runtime libraries and .Net. Then that installer can have RequestExecutionLevel
set to admin
and be extracted and executed by your primary installer as needed.
Something like this should work.
IF (user_has_net != true || user_has_c++ != true) {
SetOutPath "$TEMP"
File "OtherInstaller.exe"
ExecWait "$TEMP\OtherInstaller.exe"
}