Launch application after install as normal user

Jul 28, 2016 at 3:07 PM
Hi Ole,
my installer needs administrative priviledges. When I start my application after the installation with Process.Start it's also started with administrative priviledges. ut I don't want that. The application should start with the "original" user instance. Is there an easy way to do it?
Does this do it?:

And if yes, how do I call this custom action within my wixsharp script?
Jul 29, 2016 at 4:04 AM
Edited Jul 29, 2016 at 4:04 AM
The scenario you are describing is rather less common as usually the after-install executions need top be elevated (e.g. product itself or its config util) That is why the AfterInstall event handlers are scheduled by Wix# as deferred (elevated).

Meaning that events are not completely suitable for you. You will need to use managed custom actions instead. The code below shows how to start Notepad with normal user privileges:
var project = new Project("CustomActionTest",
        new Dir(@"%ProgramFiles%\My Company\My Product", 
            new File("setup.cs")),
        new ManagedAction(CustomActions.RunNotepad, Return.check, 
                          When.After, Step.InstallFinalize, Condition.NOT_Installed)

public class CustomActions
    public static ActionResult RunNotepad(Session session)
        try { Process.Start("notepad.exe"); } catch { }

        return ActionResult.Success;