Quantcast
Channel: wixsharp Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1354

New Post: How to implement Rollback?

$
0
0
oleg_s wrote:
Actually it is vice versa. AfterInstall is deliberately based on the deferred custom action so you have elevated execution context.
My fault. Sorry. I think it was BeforeInstall with less permissions. I had problems with permissions while I tried to remove certificates (could it be elevated in code?).
With AfterInstall I had another problem (and why I started to implement custom elevated action "InstallRunTaskAction" ) I didn't found inforamtion how to pass reference to external dll ( Microsoft.Win32.TaskScheduler.dll) which comes togather with application to AfterInstall handler to start tasks from inside of mentioned handler. In all other cases it was very good to resolve my problems.
var runTaskSchedulerAction =
                new ElevatedManagedAction("InstallRunTaskAction",
                                            Return.check,
                                            When.Before,
                                            Step.InstallFinalize,
                                            Condition.NOT_Installed)
                {
                    RefAssemblies =
                    new[] { Path.Combine(pathToSetupProjectBinDirectory, AssebmlyFileName) }
                };
oleg_s wrote:
I am not sure what you are referring to. Wix# has session.IsRepairing() extension and it doesn't throw as it uses top level try catch.
But it throws ( in deferred custom action ) and even causes rollback on uninstall and program never could be deleted with uninstaller because of exception insed custom action.

So
Is it possible to pass my assembly to AfterInstall and BeforeInstall ?
Is it possible to elevate permssions of BeforeInstall (not with RightClick->"Run as Admin" but in code) ?

My goal is:
during installation add certs and run task using custom assambly after files were copied (admin permissions required)
during remove remove certs first and stop task using custom assambly (admin permissions required)
during repair remove certs first and stop task and then add certs and run task ( (admin permissions required))
in case of rolback remove certs and stop task (reference to assambly and permissions required. With permissions for afterinstall you've just helped)

Viewing all articles
Browse latest Browse all 1354

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>