Run installer as admin always

Nov 16, 2016 at 1:30 AM
needing a msi to run as admin always, i.e. prompt UAC etc when installer starts. I need to do this so it has rights to the registry and ability to reuse a shared C# library.

I've tried these
        project.InstallScope = InstallScope.perMachine;
        project.AddProperty(new Property("MSIUSEREALADMINDETECTION", "1"));
        project.Package.AttributesDefinition = @"AdminImage=yes;InstallPrivileges=elevated";
        project.Properties.Add(new Property("Privileged", "Privileged"));
But no joy, still won't run as admin. What am I missing?

Nov 18, 2016 at 2:25 AM
In all my experiments MSI is always elevates automatically. Simply because setup writes in UserProfile. But when it doesn't than you may need to "push" it. The Internet is full of solutions but is hard to say which one works.

Try this:
project.InstallScope = InstallScope.perMachine;