简体   繁体   中英

Visual studio 2015 installer projects

I'm try to do some validation inside OnBeforeInstall method & if the validation pass will continue through the installation process, if the validation failed i want to rollback and uninstall the setup.

i tried something like this, even though this is successfull, this gave me some exceptions while rollback.

if(validation){
}
else{
    base.RollBack(savedState);
}

Exception - savedState does not contain required values or corrupted.

Please help me to do this without any exceptions.

That's not really how to cause a Visual Studio-generated MSI to roll back. You throw an InstallException, and that results in a rollback.

OnBeforeInstall isn't actually "before" the install. All Visual Studio install custom actions are called after all the files are already installed (despite the name), so the rollback actually uninstalls everything. If you are validating input (or some pre-install conditions) it's rather unfriendly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM